fazalmajid / cs1504

Python driver for the Symbol CS1504 bar code scanner
11 stars 11 forks source link

cs1504.py and Opticon OPN-2001 scanner on Linux (Ubuntu 12.04) #4

Open ndokos opened 11 years ago

ndokos commented 11 years ago

I tried running the script on this scanner and I got inconsistent results at first: sometimes it would succeed the first time and fail on any subsequent attempts. I'm not sure why that was, but eventually I would get nothing but failures, even starting from scratch (all the way to rebooting the box before plugging in the scanner).

On plugging it in, the serial port (/dev/ttyUSB0) is created successfully. I change the owner to me and run the script and get (consistently now) a termios.tcsetattr() error 22, "Invalid argument" when the init function in CS1504 tries to create the Serial() object. Trying the settings one by one, it was failing when trying to set the parity to odd:

foo.parity=serial.PARITY_ODD Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 346, in setParity if self._isOpen: self._reconfigurePort() File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 409, in _reconfigurePort termios.tcsetattr(self.fd, TERMIOS.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]) termios.error: (22, 'Invalid argument')

I tried even parity and got the same failure and then I tried NONE. AFAICT, that works consistently: half a dozen successes on half a dozen tries.

brendankehoe commented 7 years ago

The OPN 2001 actually can upload many times to the computer without disconnecting the USB cable. For me, on Windows I could get the results many times consecutively, maybe 10, with the beeps each time. This does not work for me on Linux though which prompted the inital version of this message. Also, my OPN seems to be busy for the first 5 - 10 seconds after it is plugged in on Linux, with the light slowly alternating between bright and not bright. Until that is finished, queries don't work for me.