From: Christian B. <ma...@gm...> - 2013-12-26 19:23:01
|
Ok I managed to read array('B', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) Thats is great, could you explain me what the 3 EndPoint are doing? They are IN so I need to use the write method, so probably the interrupt is going to turn on the lights and then I can read with the first EndPoint. If I decompile the DLL I should be ok to re-create a small library? :) On Thu, Dec 26, 2013 at 6:56 PM, Wander Lairson Costa < wan...@gm...> wrote: > 2013/12/26 Christian Bianchini <ma...@gm...>: > > Hello, > > I am trying to access on my OCR device that reads from invoice the number > > and fill the input text box in the webpage. > > I have the DLL for Windows and the file for Mac osx but I can't really > turn > > on the device. > > > > This is the lsusb: > > > > $ lsusb -vv -d0852:0005 > > > > Bus 001 Device 010: ID 0852:0005 CSEM > > Device Descriptor: > > bLength 18 > > bDescriptorType 1 > > bcdUSB 1.00 > > bDeviceClass 255 Vendor Specific Class > > bDeviceSubClass 0 > > bDeviceProtocol 255 > > bMaxPacketSize0 64 > > idVendor 0x0852 CSEM > > idProduct 0x0005 > > bcdDevice 0.01 > > iManufacturer 1 Xemtec SA > > iProduct 2 Xemscan > > iSerial 0 > > bNumConfigurations 1 > > Configuration Descriptor: > > bLength 9 > > bDescriptorType 2 > > wTotalLength 55 > > bNumInterfaces 1 > > bConfigurationValue 1 > > iConfiguration 0 > > bmAttributes 0x80 > > (Bus Powered) > > MaxPower 200mA > > Interface Descriptor: > > bLength 9 > > bDescriptorType 4 > > bInterfaceNumber 0 > > bAlternateSetting 0 > > bNumEndpoints 0 > > bInterfaceClass 255 Vendor Specific Class > > bInterfaceSubClass 0 > > bInterfaceProtocol 0 > > iInterface 0 > > Interface Descriptor: > > bLength 9 > > bDescriptorType 4 > > bInterfaceNumber 0 > > bAlternateSetting 1 > > bNumEndpoints 4 > > bInterfaceClass 255 Vendor Specific Class > > bInterfaceSubClass 0 > > bInterfaceProtocol 0 > > iInterface 0 > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x01 EP 1 OUT > > bmAttributes 2 > > Transfer Type Bulk > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0040 1x 64 bytes > > bInterval 0 > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x81 EP 1 IN > > bmAttributes 2 > > Transfer Type Bulk > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0040 1x 64 bytes > > bInterval 0 > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x82 EP 2 IN > > bmAttributes 3 > > Transfer Type Interrupt > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0005 1x 5 bytes > > bInterval 10 > > Endpoint Descriptor: > > bLength 7 > > bDescriptorType 5 > > bEndpointAddress 0x88 EP 8 IN > > bmAttributes 1 > > Transfer Type Isochronous > > Synch Type None > > Usage Type Data > > wMaxPacketSize 0x0284 1x 644 bytes > > bInterval 1 > > Device Status: 0x0000 > > (Bus Powered) > > > > > > I am trying to get it works under linux because there is nothing ready > and I > > would like to avoid to install windows. > > > > First thing that I found is that the Device status changes when you plug > the > > first time and then after a few seconds it changes to 0x000. > > > > This is the status when you plug it in: > > Device Status: 0x0002 > > (Bus Powered) > > Remote Wakeup Enabled > > > > It's flashing for a few second and then off, on windows it turns on > when is > > reading the numbers. > > > > So far I have made this: > > > > dev = usb.core.find(idVendor=0x0852, idProduct=0x0005) > > try: > > dev.set_configuration() > > > > except usb.core.USBError as e: > > sys.exit("Could not set configuration") > > > > endpointWrite = dev[0][(0,1)][1] > > endpointRead = dev[0][(0,1)][0] > > > > print usb.control.get_status(dev) > > > > print usb.legacy.DeviceHandle(dev).interruptRead(0x82,0x0005) > > > > First of all, you don't really want to mix up the new API with the > legacy interface. Just forget about the legacy module, it is there for > backward compatibility with PyUSB 0.4. > > > > > But the output is: > > > > 0 > > Traceback (most recent call last): > > File "test.py", line 20, in <module> > > print usb.legacy.DeviceHandle(dev).interruptRead(0x82,0x0005) > > File "/usr/local/lib/python2.7/dist-packages/usb/legacy.py", line 182, > in > > interruptRead > > return self.dev.read(endpoint, size, self.__claimed_interface, > timeout) > > File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 662, in > > read > > fn = fn_map[self._ctx.get_endpoint_type(self, endpoint, intf)] > > File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 180, in > > get_endpoint_type > > etype = util.endpoint_type(e.bmAttributes) > > AttributeError: 'NoneType' object has no attribute 'bmAttributes' > > > > > > I tried to use read, interruptWrite, etc.. but always is giving me this > > error, it seems that I have turn it on or something else. > > Can someone help me with get this device working? > > > > Now, you need to set the alternate setting to 1 (as shown by lsusb). > You may want to give a look at the PyUSB tutorial [1] to learn how to > use PyUSB functions, as well as the doc strings. > > [1] https://github.com/walac/pyusb/blob/master/docs/tutorial.rst > > -- > Best Regards, > Wander Lairson Costa > > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics > Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > _______________________________________________ > pyusb-users mailing list > pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > -- --------------------------- Admin TicinoCinema.ch chr...@ti... La tua risorsa ticinese sul cinema Admin Euservers.net chr...@eu... Hosting web |