Hi USB peoples,
I'm trying to use an FS20-PCE device:
http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=31219&flv=1&bereich=&marke=
I see it like below:
jdp@osse:~$ dmesg | tail
[ 7362.100019] usb 4-2: reset full speed USB device using uhci_hcd and
address 5
[ 7377.810020] usb 4-2: reset full speed USB device using uhci_hcd and
address 5
[ 7390.540046] usb 4-2: USB disconnect, address 5
[ 7396.650014] usb 4-2: new full speed USB device using uhci_hcd and
address 6
[ 7396.824024] generic-usb 0003:18EF:E014.0008: hiddev98,hidraw3: USB
HID v1.01 Device [ELV Elektronik AG FS20PCE] on usb-0000:00:1a.1-2/input0
[ 7491.991272] usb 4-2: reset full speed USB device using uhci_hcd and
address 6
[ 7492.141208] python[3894]: segfault at 40 ip 00007fb47e675648 sp
00007fffde4e05a0 error 4 in libusb-1.0.so.0.0.0[7fb47e66d000+d000]
[ 7709.790058] usb 4-2: USB disconnect, address 6
[ 7713.640014] usb 4-2: new full speed USB device using uhci_hcd and
address 7
[ 7713.814045] generic-usb 0003:18EF:E014.0009: hiddev98,hidraw3: USB
HID v1.01 Device [ELV Elektronik AG FS20PCE] on usb-0000:00:1a.1-2/input0
jdp@osse:~$
jdp@osse:~$ sudo lsusb -d 18ef:e014 -v
Bus 004 Device 007: ID 18ef:e014
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x18ef
idProduct 0xe014
bcdDevice 0.00
iManufacturer 1 ELV Elektronik AG
iProduct 2 FS20PCE
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 41
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 64mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
Warning: Descriptor too short
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 2
bDescriptorType 34 Report
wDescriptorLength 38
bDescriptorType 238 (null)
wDescriptorLength 8032
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0030 1x 48 bytes
bInterval 10
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0030 1x 48 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
jdp@osse:~$
I try the following code:
"""
Copied (partially) from:
Read a MagTek USB HID Swipe Reader in Linux. A description of this
code can be found at:
http://www.micahcarrick.com/credit-card-reader-pyusb.html
You must be using the new PyUSB 1.0 branch and not the 0.x branch.
Copyright (c) 2010 - Micah Carrick
"""
import sys
import usb.core
import usb.util
VENDOR_ID=0x18ef
PRODUCT_ID=0xe014
DATA_SIZE=13
device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
if device.is_kernel_driver_active(0):
try:
device.detach_kernel_driver(0)
except usb.core.USBError as e:
sys.exit("Could not detatch kernel driver: %s" % str(e))
try:
device.set_configuration()
device.reset()
except usb.core.USBError as e:
sys.exit("Could not set configuration: %s" % str(e))
endpoint = device[0][(0,0)][0]
data = []
swiped = False
print "Send a code..."
while 1:
try:
print "Try to read...", endpoint.bEndpointAddress,
endpoint.wMaxPacketSize
data += device.read(endpoint.bEndpointAddress,
endpoint.wMaxPacketSize)
if not swiped:
print "Reading..."
swiped = True
except usb.core.USBError as e:
if e.args == ('Operation timed out',) and swiped:
if len(data) < DATA_SIZE:
print "Bad swipe, try again. (%d bytes)" % len(data)
print "Data: %s" % ''.join(map(chr, data))
data = []
swiped = False
continue
else:
break # we got it!
And got the following result:
jdp@osse:~$
jdp@osse:~$ sudo python
/net/gandalf/srv/home/jdp/komodo/fs20/src/test_libusb10_a.py
Send a code...
Try to read... 129 48
Erreur de segmentation
jdp@osse:~$
Any clue about how to go further?
Best regards, Jacques-D. Piguet
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
pyusb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyusb-users