Closed midwan closed 2 years ago
Run gw --bt info
to get a backtrace. You will additionally want to remove the try/except
wrapper around util.usb_open()
in tools/info.py
, or the exception gets consumed.
One possibility here might be that a daemon or driver has ttyACM0 open, or has written garbage to it (eg. modem probing). There is a udev script 49-greaseweazle.rules
which although tested on Ubuntu likely applies as-is to Arch/Manjaro too.
Here's the full output:
[midwan@pi400 greaseweazle]$ ./gw --bt info
Host Tools: v0.38
Device:
Traceback (most recent call last):
File "/home/midwan/.local/lib/python3.10/site-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 5] Input/output error: '/dev/ttyACM0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/midwan/projects/greaseweazle/./gw", line 11, in <module>
import gw
File "/home/midwan/projects/greaseweazle/scripts/gw.py", line 108, in <module>
res = main(argv)
File "/home/midwan/projects/greaseweazle/scripts/greaseweazle/tools/info.py", line 63, in main
usb = util.usb_open(args.device, mode_check=False)
File "/home/midwan/projects/greaseweazle/scripts/greaseweazle/tools/util.py", line 388, in usb_open
usb = USB.Unit(serial.Serial(devicename))
File "/home/midwan/.local/lib/python3.10/site-packages/serial/serialutil.py", line 244, in __init__
self.open()
File "/home/midwan/.local/lib/python3.10/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 5] could not open port /dev/ttyACM0: [Errno 5] Input/output error: '/dev/ttyACM0'
I have already applied the udev script, and I can see the symlink pointing to the same device (/dev/ttyACM0
).
That looks like a pretty hard error on opening /dev/ttyACM0
. Can you open it using any other tools eg miniterm
?
@keirf
I've tried multiple things, even a different kernel, but in all scenarios I cannot access /dev/ttyACM0
no matter what I do 😞
It's very strange, and I've run out of ideas to try for now. I'll let you know if I make any progress...
Do you see anything interesting in dmesg on failure to open?
Nothing unexpected, from what I can see:
[ 194.183851] usb 1-1.2: reset full-speed USB device number 6 using xhci_hcd
[ 194.289921] usb 1-1.2: USB disconnect, device number 6
[ 194.371586] usb 1-1.2: new full-speed USB device number 7 using xhci_hcd
[ 194.478861] usb 1-1.2: New USB device found, idVendor=1209, idProduct=4d69, bcdDevice= 1.00
[ 194.478872] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 194.478876] usb 1-1.2: Product: Greaseweazle
[ 194.478880] usb 1-1.2: Manufacturer: Keir Fraser
[ 194.478883] usb 1-1.2: SerialNumber: GW135195064205400002741705
[ 194.481522] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
I did another test on a fresh Debian 64-bit Bookworm, which also worked fine. This seems to be a problem only in Manjaro, but I have no idea why.
Perhaps the device is open already? Does sudo lsof /dev/ttyACM0
show anything?
[midwan@pi400 greaseweazle]$ sudo lsof /dev/ttyACM0
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
I also checked if there was any conflict with ModemManager, but that service is not loaded anyway:
systemctl stop ModemManager.service
Failed to stop ModemManager.service: Unit ModemManager.service not loaded.
I know that Manjaro/Arch is a bit more restrictive with permissions, since when I was testing with the Arduino controller (Rob Smith's one) I couldn't access the tty device until I was a member of the group. So I checked and added my user to all relevant groups as well: uucp
, tty
are included.
This is how the device looks like:
[midwan@pi400 greaseweazle]$ ls -al /dev/ttyACM0
crw-rw-rw- 1 root uucp 166, 0 2 feb 16.54 /dev/ttyACM0
I tried using screen
to connect to it, which works on RPIOS (where the device is detected from gw info
) but fails on Manjaro immediately:
[midwan@pi400 greaseweazle]$ screen /dev/ttyACM0
[screen is terminating]
[screen is terminating]
Could be a kernel bug/issue? https://forum.manjaro.org/t/usb-device-dev-ttyacm0-throws-i-o-error-on-connect/61385
That looks very possible, thanks :) I'll wait until they push the update and test it again there.
So I checked and added my user to all relevant groups as well: uucp, tty are included.
After you added yourself to those groups did you log out and back in to collect the new permissions? You can always check what you have at present with id -a
@andrewbird Yes, I did. :) I swapped SDcards on the same device during tests (to try the same on other distros), so the whole system was shutdown and started up between them.
I've been testing the GW on 3 different Linux ARM distros so far:
I've installed the host tools from the repo, in all 3 scenarios:
make && scripts/setup.sh
Things work perfectly on RPIOS 32-bit.
gw info
reports the device normally, and it works fine in Amiberry as well (with theFloppyBridge.so
library by Rob Smith).On RPIOS 64-bit,
gw info
still reports the device normally, but it doesn't work on Amiberry. I suspect this is related to theFloppyBridge.so
part however, as I can read a disk to an image usinggw
.But I have a strange situation on Manjaro OS, where
gw info
reports that the device wasNot Found
always. The device is connected and detected by the OS, from what I can see. Here's an extract fromdmesg
:And yet:
From what I could see in the Python sources, this would happen if an exception was thrown while trying to open the serial device. Is there a way to get more detailed output, to try and figure out what might be going on here?