ZuLuuuuuu
Posts: 26
Joined: Thu May 23, 2013 6:30 am

Error when reading data from USB touch screen controller

Thu Apr 27, 2017 5:45 pm

Hello, I am trying to get absolute coordinates from a USB touch screen controller. I am using Python evdev library. The problem is that when I start the program, and start touching the screen, it reads a few events for a while and then gives a "No such device" error and quits.

The lsusb output is:

Code: Select all

Bus 001 Device 011: ID 045e:07fd Microsoft Corp. 
Bus 001 Device 019: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen
Bus 001 Device 010: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 009: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The Python program is:

Code: Select all

import evdev
from evdev import InputDevice

devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()]
for device in devices:
    print(device.fn, device.name, device.phys)

dev = InputDevice('/dev/input/event3')

for event in dev.read_loop():
    print(event)
And a sample output of a run of this program is:

Code: Select all

/dev/input/event3 eGalax Inc. USB TouchController usb-3f980000.usb-1.2/input0
/dev/input/event2 Microsoft Microsoft Nano Transceiver 1.1 usb-3f980000.usb-1.4/input2
/dev/input/event1 Microsoft Microsoft Nano Transceiver 1.1 usb-3f980000.usb-1.4/input1
/dev/input/event0 Microsoft Microsoft Nano Transceiver 1.1 usb-3f980000.usb-1.4/input0
event at 1493313778.350586, code 330, type 01, val 01
event at 1493313778.350586, code 00, type 03, val 126
event at 1493313778.350586, code 01, type 03, val 70
event at 1493313778.350586, code 00, type 00, val 00
event at 1493313778.394576, code 00, type 03, val 125
event at 1493313778.394576, code 00, type 00, val 00
event at 1493313778.406592, code 00, type 03, val 124
event at 1493313778.406592, code 00, type 00, val 00
event at 1493313778.648907, code 330, type 01, val 00
event at 1493313778.648920, code 00, type 00, val 01
Traceback (most recent call last):
  File "Touchscreen.py", line 10, in <module>
    for event in dev.read_loop():
  File "/usr/local/lib/python3.4/dist-packages/evdev/eventio.py", line 42, in read_loop
    for event in self.read():
  File "/usr/local/lib/python3.4/dist-packages/evdev/eventio.py", line 67, in read
    events = _input.device_read_many(self.fd)
OSError: [Errno 19] No such device
So what might be the problem?

ZuLuuuuuu
Posts: 26
Joined: Thu May 23, 2013 6:30 am

Re: Error when reading data from USB touch screen controller

Sun Apr 30, 2017 11:32 am

I guess I found the problem: the power going to my Raspberry Pi was insufficient. It was giving power warning at the corner of the screen. I plugged another power supply, both the warning disappeared and the touch controller started to work without giving any errors.

Return to “Automation, sensing and robotics”