So I have a Datalogic barcode scanner configured as USB-COM to send data over USB (not as keyboard)
This works fine on Raspberry Pi OS 11 Lite, so I know the hardware is working.
I first discovered it using the Python and pyserial where each time I’d scan something, I’d get
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?).
So first I tried to use Python 3.9 (as I did on the Raspberry Pi, instead of Python 3.10) but same issue.
So I tried
cat /dev/ttyACM0, which waits until I scan something.
On the raspberry, when I scan something it gives the barcode and continues waiting for the next one.
On Fedora it, when I scan something, the command exits.
So I’d guess that on Fedora something is consuming the data before I can get it, because when I scan something, the system knows it since it either triggers the Python exception, or exits the cat command.
I saw something about checking for getty in inittab, but that’s not used anymore
I’m using Fedora 35 workstation fully up-to-date
This sounds like there are 2 (or more) different processes accessing that node in /dev which causes a conflict and one is blocked from reading.
There recently was a thread about usb ports with printers using proprietary drivers and ipp-usb blocking access to the printer. Your issue sounds similar and may be related to something blocking that usb port.
Do you have ipp-usb installed?
No, it’s not installed. I saw some mentions that cups installs it by default (and I have cups installed), but ipp-usb isn’t installed.
I just remembered that I also tried inotifywatcher to see what access ttyACM0.
It tells me
total attrib delete_self filename
3 1 1 /dev/ttyACM0
but not the process.
I tried auditctl, but got no matches.
lsof is another command that can tell you the processes accessing a device or file.
sudo lsof | grep -i ttyACM0 and see what the results are.
Does this happen as a normal user? Do you have to start a communication app terminal like
If you want to work with a normal user then you should try to put you in the dial-out group.
Just a thought because of your error you get.
On the rasperry pi you might work with root … so that’s why it works ?!
As I understand it, this only gives the processes at the moment I run that command.
But I suspect that a process only access ttyACM0 very very briefly when I scan, so I’d need to perfectly time both.
The command as is (with -i instead of --i) didn’t give any results
Yes, normal user on both devices, the user is a member of dialout on both. No communication app either, but just to be sure, I tried on the device itself using the gnome terminal.
You are correct on the results returned, but since you have not told us how you are using the scanner we cannot tell if it is active all the time or only intermittently. We also do not know what app you are using to read from the scanner.
There are two different situations with the bar code scanner.
In one scenario it is idle and only activated when you deliberately activate it.
In the other (and in my experience more likely) it remains active and sends the scan result whenever it actively scans a bar code. This is the way scanners at POS terminals work everywhere.
If it is constantly active then the lsof command should return the process that is using it. If only connected but not active then lsof will not return anything for it
To verify you are in the correct group to access it, try doing
ls -l /dev/ttyACM0 when you have it connected and activated so you can see the ownership of the device, then make certain your user is a member of the group owning the device and that the group has rw permissions on the device.
Owner is root and group is dialout
Same thing on RPi
I’m not sure I see the difference in your two scenarios, in both cases, it will send a barcode when it scans a barcode.
In my testing, I pull the trigger to scan a barcode.
The endgoal is to do something with that barcode:
with serial.Serial(device, 19200, timeout=0) as ser:
line = ser.readline()
line = line.strip()
if len(line) > 0:
# Handle the barcode
but since that failed, I started with simply doing
cat/dev/tty/ACM0 in the terminal