Go to advanced search

by Bosse_B
Fri May 01, 2020 7:21 pm
Forum: General discussion
Topic: Proprietary add-on board, how to detect its presence?
Replies: 5
Views: 282

Re: Proprietary add-on board, how to detect its presence?

You've already got the HAT EEPROM which does this. Look in /proc/device-tree/hat/ ls -la /proc/device-tree/hat/ ls: cannot access '/proc/device-tree/hat/': No such file or directory Using HAT was the plan, but I am not sure what to put into it in order to get it working. The RPi HAT specification i...
by Bosse_B
Fri May 01, 2020 4:23 pm
Forum: General discussion
Topic: Proprietary add-on board, how to detect its presence?
Replies: 5
Views: 282

Proprietary add-on board, how to detect its presence?

We have designed a proprietary PC board to plug into the 40-pin connector. The board contains the following subsystems: 1) An I2C bus where we have connected the following devices - An EEPROM for storage of config data - An AWS encryption chip - An RTC circuit with battery to keep accurate time in t...
by Bosse_B
Mon Apr 27, 2020 1:31 pm
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

A little extreme, but shows the problem... When designing a system that is supposed to be deployed by other people I prefer to be able to write instructions along the line: 1) Attach the USB cable from the switchbox to the upper left USB connector 2) Attach the USB serial interface from the instrume...
by Bosse_B
Mon Apr 27, 2020 12:09 pm
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

I do not see that Raspbian "out of the box" creates a device other than the ttyUSBx where x designates the order of detection of the USB device. The underlying devices are always called ttyUSB N , but those symlinks you showed are perfectly valid ways to open the device, and the symlinks automatica...
by Bosse_B
Mon Apr 27, 2020 10:06 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

lrwxrwxrwx 1 root root 13 Apr 27 07:07 usb-FTDI_US232R_FTFK085Y-if00-port0 -> ../../ttyUSB1 lrwxrwxrwx 1 root root 13 Apr 27 07:07 usb-FTDI_US232R_FTFK0869-if00-port0 -> ../../ttyUSB0 So if I can read this S/N in my code then I could presumably identify the adapter that belongs to a specific connec...
by Bosse_B
Mon Apr 27, 2020 10:00 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

Thanks again! I think the last suggestion, which I have now tested makes best sense at least for this project. I put this into the file /etc/udev/rules.d/99-usb-serial.rules: SUBSYSTEM=="tty",ENV{ID_PATH}=="platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0",SYMLINK+="ttyUSB001" SUBSYSTEM=="tty",...
by Bosse_B
Mon Apr 27, 2020 7:05 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

So if I can read this S/N in my code then I could presumably identify the adapter that belongs to a specific connection.... It would be really good to be able to open the port based on the serial number instead of the ttyUSBx name. The proper way to do this is to use udev rules and let Linux sort i...
by Bosse_B
Mon Apr 27, 2020 5:16 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

Re: How to detect individual USB-RS232 device tty number?

OK, first, lsusb -t does not do the trick: $ lsusb -t /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 3: Dev 5, If 0, Class=Vendor Specific Class, Dri...
by Bosse_B
Sun Apr 26, 2020 9:46 pm
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 1133

How to detect individual USB-RS232 device tty number?

I am planning a conversion from Windows to Raspbian of a software control program. It uses two serial ports to handle external equipment and I was planning to use a pair of USB-RS232 converters. The two channels have completely different use and are connected to different boxes. Now when looking at ...
by Bosse_B
Sat Apr 18, 2020 4:09 pm
Forum: General discussion
Topic: How to configure VNC server to run without local login?
Replies: 7
Views: 529

Re: How to configure VNC server to run without local login?

I just wonder how to make the vnc server start and run properly if there is no local user logged in on the unit (a headless machine)? Maybe what I wrote in post #10 of this thread will help you Thanks for the link to the other discussion. It seems a lot like what I have done meanwhile using informa...
by Bosse_B
Sat Apr 18, 2020 3:59 pm
Forum: General discussion
Topic: How to configure VNC server to run without local login?
Replies: 7
Views: 529

Re: How to configure VNC server to run without local login?

I only have one monitor and it is connected to my Windows 10 PC. Then I also have a bunch of RPi units ranging from 2-3-4 and on these I can easily work from my PC using the VNC windows. It would be nice to be able to centralize handling of all of these. I run all of my RPis headless from first boo...
by Bosse_B
Sat Apr 18, 2020 1:31 pm
Forum: General discussion
Topic: How to configure VNC server to run without local login?
Replies: 7
Views: 529

Re: How to configure VNC server to run without local login?

I think the difference between raspbian and ubuntu is that by default when the raspbian desktop is started the user pi is automatically logged in Not really, when my RPi units start up they sit on the login screen forever since there is no keyboard or monitor attached (headless). But on the RPi uni...
by Bosse_B
Sat Apr 18, 2020 6:55 am
Forum: General discussion
Topic: How to configure VNC server to run without local login?
Replies: 7
Views: 529

How to configure VNC server to run without local login?

I just wonder how to make the vnc server start and run properly if there is no local user logged in on the unit (a headless machine)? On Raspbian it seems to work fine, but I have now tried to make the same work on a Ubuntu 18.04 installation and there it won't work unless I log in locally first. I ...
by Bosse_B
Thu Apr 16, 2020 5:25 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

The last argument to the getopts call is optional and if missing getopts reverts to use the full command line arguments as given by $@. But this seems not to work inside a function , ... Seems like if inside a function it is unable to get the input arguments from the command line! But reading these...
by Bosse_B
Thu Apr 16, 2020 5:20 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

My question is really when are quotes needed, accepted or forbidden? For example in connection with getopts it seems like putting quotes around is forbidden, but the code above works both ways. So sometimes needed and sometimes not or forbidden, what is the rule here? I'm not clear what you mean by...
by Bosse_B
Thu Apr 16, 2020 3:11 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

I have a general scripting question: Say that I have a variable appargs which is set by appargs=$@ So now it holds all of the command line options entered when the script started. When I want to test this (not using getopts) for example like this: if [ -z $appargs ] then echo "Missing options!" show...
by Bosse_B
Thu Apr 16, 2020 9:52 am
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

So I think I nailed it now! The problem seems to be the way getopts gets its input. The last argument to the getopts call is optional and if missing getopts reverts to use the full command line arguments as given by $@. But this seems not to work inside a function , so what I did was this: #!/bin/ba...
by Bosse_B
Thu Apr 16, 2020 6:34 am
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

It seems not to like getopts being in a function. Possibly the arguments list is reset for a function call, though I'm not aware of that. .... Edit - you can use getopts in a function, see https://stackoverflow.com/questions/16654607/using-getopts-inside-a-bash-function but it's a much more complic...
by Bosse_B
Thu Apr 16, 2020 5:43 am
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

Greg Erskine wrote:
Wed Apr 15, 2020 11:18 pm
I think a ) should be a)

c doesn't equal "a " but "a"
I have tried both a ) and a), no difference.
I started out without the space, then I saw the space in one on-line example and tried that, to no avail.
by Bosse_B
Wed Apr 15, 2020 10:41 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

It seems like I am hunted by ghosts when writing scripts... I cannot get the getopts function to work properly. So I have shifted to a test script just in order to get the argument parsing with getopts working. But it is not. Here is my parsetest.sh script: #!/bin/bash function showhelp { echo "Vali...
by Bosse_B
Wed Apr 15, 2020 3:08 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

Thanks, I will look over the existing script, currently it is 231 lines (lots of comments).
Good ideas here!
by Bosse_B
Wed Apr 15, 2020 1:10 pm
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Re: Scripting woes, cannot parse inut values properly..

Thanks all! I think I will use the case structure to handle the various commands. Did not know it was available. It is very confusing when to use == and when not to... As well as how to nest if, else, elif, fi etc... Question regarding case usage (I have looked up instructions on the net): I want to...
by Bosse_B
Wed Apr 15, 2020 9:22 am
Forum: General discussion
Topic: Scripting woes, cannot parse inut values properly..
Replies: 28
Views: 1138

Scripting woes, cannot parse inut values properly..

I am trying to multi-purpose a script I have used to install a development IDE such that I can command it to select parts of the install depending on an input argument. I have studied a lot of tutorials on bash scripting but I simply cannot get this to work.. Please tell me what I am doing wrong in ...
by Bosse_B
Tue Apr 14, 2020 7:02 am
Forum: General discussion
Topic: How to read external IP address into a variable in a script?
Replies: 2
Views: 160

Re: How to read external IP address into a variable in a script?

Thanks!
I think it is easy enough - it is working fine!
by Bosse_B
Tue Apr 14, 2020 6:41 am
Forum: General discussion
Topic: How to read external IP address into a variable in a script?
Replies: 2
Views: 160

How to read external IP address into a variable in a script?

I would like to log my external IP , i.e. the WAN IP address of the router, on an RPi4 unit, which sits on a mobile broadband connection. It seems like the external IP address changes frequently so I would like to create a log of the address. I can do all items in a script except I don't know how to...

Go to advanced search