1

A strange one!

I'm trying to use the on-board UART, /dev/ttyAMA0, with dixprs.

I'm on Raspbian Jessie, and have:

  • Taken the ttyAMA console out of /boot/cmdline.txt
  • Disabled agetty on ttyAMA0 with "/bin/systemctl mask serial-getty@ttyAMA0.service" (and confirmed it's no longer running after a reboot)
  • Checked the pi user is a member of tty and dialout groups

Now, if I plug in a random Prolific USB->RS232 adaptor (which appears as /dev/ttyUSB0), /dev/ttyAMA0 suddenly starts working!

If I remove it and restart the app, it stops - until I re-insert the Prolific device and restart the app again [EDIT 2016-02-02: doesn't even need an app restart to take effect. As soon as ttyUSB0 removed, it stops working; as soon as it's reinserted, it starts again. dixprs keeps the char device open throughout, I think]. (I've grepped the python in question for any hard-coded mentions of ttyUSB0, just in case, and lsof shows only ttyAMA0 in use while the app is running.)

It sort of feels like the presence of the USB device causes some permissions to be dynamically set, but I can't think nor see what...

Anything obvious I'm missing?

Edit to add: pi@mb7ups-pi:~ $ uname -a Linux mb7ups-pi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux pi@mb7ups-pi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" pi@mb7ups-pi:~ $ ls -l /dev/ttyAMA0 /dev/ttyUSB* # Without USB device plugged in ls: cannot access /dev/ttyUSB*: No such file or directory crw-rw---- 1 root dialout 204, 64 Feb 3 09:08 /dev/ttyAMA0 pi@mb7ups-pi:~ $ ls -l /dev/ttyAMA0 /dev/ttyUSB* # With USB device plugged in crw-rw---- 1 root dialout 204, 64 Feb 3 09:08 /dev/ttyAMA0 crw-rw---- 1 root dialout 188, 0 Feb 3 09:10 /dev/ttyUSB0 pi@mb7ups-pi:~ $ groups pi adm tty dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

Edit a bit more: OK, it's not permissions. If I run Python as root (yes, I know... testing :-p), it still shows the same behaviour. I'm wondering if there's some hardware issue that the addition of the Prolific is triggering...

  • try to read-write to that tty with and without your USB device - is it working ok? Like this UPD 3/2/2016 : OK, and now take a look - is your USB-attached RS-232 converter receives always the same /dev/xxx entry? Regardless of replugs and reboots? – Alexey Vesnin Feb 3 '16 at 4:09
  • Could you add details of your kernel and operating system plus permissions to your post? E.g. uname -a, cat /etc/os-release, ls -l /dev/ttyAMA0. Permissions before and after plugging in the USB device please. – joan Feb 3 '16 at 8:46
  • @joan Sorry - added! – rmc47 Feb 3 '16 at 9:12
  • I can cat /dev/ttyAMA0 in all circumstances - it returns immediately with no error both with and without the USB device plugged in. The modem (a Pi-TNC) doesn't speak an ASCII protocol so not easy to send it meaningful data from minicom or similar, but no permission denied errors in evidence at least... – rmc47 Feb 3 '16 at 9:13
  • Those permissions look correct (crw-rw---- 1 root dialout 204, 64 Feb 3 09:08 /dev/ttyAMA0) before and after. Have you used lsof to see if anything else has the device open? E.g. sudo apt-get install lsof; sudo lsof /dev/ttyAMA0. – joan Feb 3 '16 at 9:24
2

So... after swapping to a different PSU, all seems to be as it should with the world.

Sorry for the slightly wild goose chase folks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.