Hello, Wander Lairson wrote: > Well, I think you are doing things in the right way, may be the > problem is a device protocol issue. Perhaps you are issuing the wrong > command to get what you want... How do you get the storage capacity? > How many bytes are expected to return? Please, post the code here > (with comments). >
Thanks for the reply, I am going to try an paste functions to see if it helps: This section says hello to the device in question and works just fine. sent_bytes = self.handle.interruptWrite(PlugUSBDevice.PLUG_BULK_IN_EP, PlugUSBDevice.MIMIO_HELLO, 1000) print "Sent hello" if sent_bytes: read_bytes = self.handle.interruptRead(PlugUSBDevice.PLUG_BULK_OUT_EP,8); self.readDevice(read_bytes) readDevice starts: def readDevice(self, response): #response = self.handle.interruptRead(PlugUSBDevice.PLUG_BULK_OUT_EP,8); if response: print "readDevice", response if response == PlugUSBDevice.MAX_PACKET_SIZE: return #print response #firstByte = response[0] #print firstByte #print [hex(d) for d in response] if response[0] == 0x21: print "Device responded to hello" self.devicestate = response[1] And I get the device telling me it responded. I can now issue several other commands which query the storage information in a similar way and get the information I expect. My main issue is that I cannot issue a data transmit command and get pen xy coordinates, I just get: usb.USBError: No error I start it by issuing a command like the others: def startDataXmit(self, timeout = 100): sent_bytes = self.handle.interruptWrite(PlugUSBDevice.PLUG_BULK_IN_EP, PlugUSBDevice.MIMIO_STARTDATATRANS, 1000) if sent_bytes: read_bytes = self.handle.interruptRead(PlugUSBDevice.PLUG_BULK_OUT_EP,sent_bytes); self.readDevice(read_bytes) print "startDataXmit" Then in a loop I call: def getDataPacket(self, bytesToGet) : """ Assume bytesToGet is two bytes wide. """ print "getDataPacket" read_bytes = self.handle.interruptRead(PlugUSBDevice.PLUG_BULK_OUT_EP,bytesToGet); #read_bytes = self.handle.bulkRead(PlugUSBDevice.PLUG_BULK_OUT_EP,bytesToGet,1000) self.readDevice(read_bytes) Where I get the "No error" error on the interruptRead line. The documentation for the protocol does not talk about low level USB details only that the if the data becomes out of sync I must issue a stop command and re-sync the communication channel (of which I am not sure what that is). Any hints on the "No error" problem? Regards Phil Hannent
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Pyusb-users mailing list Pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users