From: <seb...@bb...> - 2013-05-24 23:27:08
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv=Content-Type content="text/html; charset=iso-8859-15"> <title>Bouygues Telecom</title> <style type="text/css"> BODY, TABLE, TR, TD, P {margin:0;padding:0;} BODY {background:#FFFFFF;} </style> </head> <body> Hello and sorry for my english.<br><br>I would like run a relay card by pyusb but i cant find any help.<br>I can run my card with (in terminal) echo -e '\xff\x01\x00' > /dev/ttyACM0<br>But if i try anything with pyusb nobody run.<br><br>Can you help me please ? <br> </body></html> |
From: Jeff R. <je...@ro...> - 2014-12-06 06:12:17
|
Hello PyUSB community! I'm trying to solve a raw HID write delay problem when using PyUSB 1.0.0b2 with Python 2.7 in an Ubuntu 14.10 Linux environment, actually running inside a VMware Player virtual machine on a Windows 8.1 64-bit desktop. I'm communicating from the Python script to a Teensy++ configured in Raw HID mode. I have been able to make this work perfectly in Windows using PyWinUSB, and using the Teensy++ manufacturer's own RawHID C demo code, and *almost* in Linux with PyUSB. In fact, I even get the data moving back and forth over the IN and OUT interrupt endpoints, intact and in order. The problem is that there is a very measurable delay (usually between 200ms and 500ms, varying) whenever I try to use the .write() method to send data to the device. I receive it instantly whenever anything new comes in; I've narrowed down the delay very specifically to the single line that attempts to send data: self.pyusb_endpoint_out.write(raw_packet) The "raw_packet" variable is an array of bytes. The data is delivered properly, and everything else works great on the device and in the response that comes back, so I know it's being interpreted correctly. It just takes way longer than it should. First, here's the string representation of the interface that I'm using: INTERFACE 0: Human Interface Device ==================== bLength : 0x9 (9 bytes) bDescriptorType : 0x4 Interface bInterfaceNumber : 0x0 bAlternateSetting : 0x0 bNumEndpoints : 0x2 bInterfaceClass : 0x3 Human Interface Device bInterfaceSubClass : 0x0 bInterfaceProtocol : 0x0 iInterface : 0x2 Teensyduino RawHID ENDPOINT 0x83: Interrupt IN ========================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x83 IN bmAttributes : 0x3 Interrupt wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x1 ENDPOINT 0x4: Interrupt OUT ========================== bLength : 0x7 (7 bytes) bDescriptorType : 0x5 Endpoint bEndpointAddress : 0x4 OUT bmAttributes : 0x3 Interrupt wMaxPacketSize : 0x40 (64 bytes) bInterval : 0x1 I read data from 0x83 and send it out 0x4. Both are interrupt endpoints, so I would assume this should be pretty straightforward. The Python script is fairly complicated, so I won't post the whole thing here (though I will be happy to post it on Github if needed; that's where it will end up, but I was kinda hoping to actually make it work first). However, salient points about its functionality are these: 1. It's running in VM of Ubuntu 14.10, on a Win8 machine. I can try a non-VM Ubuntu environment, but it will take some time to arrange that. 2. The script starts a separate daemon thread which constantly tries to read from endpoint 0x83, timing out every second and retrying whenever there is no data available. This approach seems to work perfectly, but I'm wondering if it has some adverse effect on the ability to write data in a timely fashion. The thread runs in a single handler function that looks like this: # handler for reading incoming raw HID packets via PyUSB (thread started in local connect() method) def pyusb_read_handler(self): while self.pyusb_endpoint_in != None and self.connected: try: ret = self.devobj.read(self.pyusb_endpoint_in.bEndpointAddress, self.pyusb_endpoint_in.wMaxPacketSize) if len(ret) > 0 and ret[0] > 0: for b in ret[1:ret[0] + 1]: if self.kgapi.parse(b) == 0xC0: self.responses_pending = self.responses_pending - 1 if self.responses_pending == 0: self.on_api_idle() except usb.core.USBError as e: if e.errno == 110: # PyUSB timeout, probably just no data sys.exc_clear() elif e.errno == 5 or e.errno == 19: # "Input/Output Error" or "No such device", this is serious self.on_unplugged() self.disconnect() else: raise KeygloveHIDError("PyUSB read thread error: %s" % e) 3. The packets being sent are 64 bytes in size. The trailing bytes beyond the important part of the data payload are padded to zeros to fill the whole size. I had originally tried without doing this (by accident, in fact), so the byte array I wrote was only perhaps 5-10 bytes long, and then realized that I'd forgotten to pad it. However, the same delay exists whether or not the bytes are zero-padded out to the full report size, so that isn't it. Given the above, is there ANY reason why there would be a 100+ millisecond seemingly arbitrary delay sending a 64-byte packet? --Jeff |
From: UNIVERSAL P. <uni...@gm...> - 2015-05-27 09:21:54
|
How to list USB device ? |
From: UNIVERSAL P. <uni...@gm...> - 2015-05-27 12:22:41
|
Hi, I would like enable or disable a USB port, do you have example ? Thks |
From: UNIVERSAL P. <uni...@gm...> - 2015-05-30 12:43:04
|
Hi, this is my program: *import usb.util* *import usb.core* *import sys* *dev=usb.core.find()* *dev.set_configuration()* this is the error message: *usb.core.USBError:could not set config 1: Device or resource busy* *What's wrong with my program ?* |
From: Wander L. C. <wan...@gm...> - 2015-05-31 14:46:55
|
2015-05-30 9:42 GMT-03:00 UNIVERSAL PHONE <uni...@gm...>: > Hi, > > > this is my program: > > import usb.util > import usb.core > import sys > > dev=usb.core.find() > dev.set_configuration() > > this is the error message: > > usb.core.USBError:could not set config 1: Device or resource busy > > > > What's wrong with my program ? > What Operating System are you using? -- Best Regards, Wander Lairson Costa |
From: UNIVERSAL P. <uni...@gm...> - 2015-06-09 09:34:23
|
> > Message: 1 > Date: Sun, 31 May 2015 11:46:07 -0300 > From: Wander Lairson Costa <wan...@gm...> > Subject: Re: [pyusb-users] (no subject) > To: pyusb-users <pyu...@li...> > Message-ID: > <CAFsSK4bbWhZ-Q6nUDZqWDFMVx9qRwvETN47= > jBt...@ma...> > Content-Type: text/plain; charset=UTF-8 > > 2015-05-30 9:42 GMT-03:00 UNIVERSAL PHONE <uni...@gm...>: > > Hi, > > > > > > this is my program: > > > > import usb.util > > import usb.core > > import sys > > > > dev=usb.core.find() > > dev.set_configuration() > > > > this is the error message: > > > > usb.core.USBError:could not set config 1: Device or resource busy > > > > > > > > What's wrong with my program ? > > > > What Operating System are you using? > > ---* I'm running SUSE LINUX ENTERPRISE DESKTOP 12 * |
From: Wander L. C. <wan...@gm...> - 2015-06-10 10:37:05
|
2015-06-09 6:34 GMT-03:00 UNIVERSAL PHONE <uni...@gm...>: >> Message: 1 >> Date: Sun, 31 May 2015 11:46:07 -0300 >> From: Wander Lairson Costa <wan...@gm...> >> Subject: Re: [pyusb-users] (no subject) >> To: pyusb-users <pyu...@li...> >> Message-ID: >> >> <CAFsSK4bbWhZ-Q6nUDZqWDFMVx9qRwvETN47=jBt...@ma...> >> Content-Type: text/plain; charset=UTF-8 >> >> 2015-05-30 9:42 GMT-03:00 UNIVERSAL PHONE <uni...@gm...>: >> > Hi, >> > >> > >> > this is my program: >> > >> > import usb.util >> > import usb.core >> > import sys >> > >> > dev=usb.core.find() >> > dev.set_configuration() >> > >> > this is the error message: >> > >> > usb.core.USBError:could not set config 1: Device or resource busy >> > >> > >> > >> > What's wrong with my program ? >> > >> >> What Operating System are you using? >> > > --- I'm running SUSE LINUX ENTERPRISE DESKTOP 12 > The problem must be you have a driver attached to your device. You can find examples on how to detach the driver from the device in other messages in this mailing list. -- Best Regards, Wander Lairson Costa |
From: Jay N. <ja...@ne...> - 2016-05-11 14:44:11
|
Ok, I was working with my program some more. As I stated in previous posts I am packaging my program with pyinstaller and have no issues with version 2.1. Normally I package into one file. I decided to package into one directory. Doing this I am able to see everything that pyinstaller packaged. I did the same with pyinstaller version 3.1.1 and compared what was packaged. The only difference is that pyinstaller version 2.1 has the libusb dll file in the directory folder and the pyinstaller version 3.1.1 does not have the dll in the directory folder. I manually moved the dll to this directory and my program works. For now I can work with the one directory but it makes my install package with WIX more work but I will be trying to get the dll into the one file. Not sure what broke but I was able to figure out what was missing. |
From: chris c. <cl...@gm...> - 2016-05-12 01:11:52
|
On Wed, May 11, 2016 at 7:44 AM, Jay Newens <ja...@ne...> wrote: > I was working with my program some more. As I stated in previous posts I > am packaging my program with pyinstaller and have no issues with version > 2.1. Normally I package into one file. I decided to package into one > directory. Doing this I am able to see everything that pyinstaller > packaged. I did the same with pyinstaller version 3.1.1 and compared what > was packaged. The only difference is that pyinstaller version 2.1 has the > libusb dll file in the directory folder and the pyinstaller version 3.1.1 > does not have the dll in the directory folder. I manually moved the dll to > this directory and my program works. For now I can work with the one > directory but it makes my install package with WIX more work but I will be > trying to get the dll into the one file. Not sure what broke but I was able > to figure out what was missing. > Thanks for reporting back. Its probably worth pursuing this with PyInstaller as that sounds like a bug in the new version or perhaps warrants a KB doc if its not considered a bug. I have to confess as I've had such good success with Py2exe in the past (I only need to roll binaries for Windows, not other platforms which is one of PyInstaller key features), Py2exe is pretty good at warning when it thinks it has missed a dll and you can specify how to include them should the need arise, so hopefully that's an option with PyInstaller too? The other thing I like about py2exe is that there are add-ons that create installers for you (you mentioned dealing with Wix), e.g. https://code.google.com/archive/p/py2nsis/, again hopefully there is a similar thing for PyInstaller Chris |
From: Alan J. A. S. <al...@ho...> - 2013-05-25 00:58:19
|
Hi, Seems that your card is a "serial" device and not usb? Try with pyserial: http://pyserial.sourceforge.net/ Regards! Alan From: seb...@bb... To: pyu...@li... Date: Sat, 25 May 2013 01:26:59 +0200 Subject: [pyusb-users] (no subject) Bouygues Telecom Hello and sorry for my english. I would like run a relay card by pyusb but i cant find any help. I can run my card with (in terminal) echo -e '\xff\x01\x00' > /dev/ttyACM0 But if i try anything with pyusb nobody run. Can you help me please ? ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ pyusb-users mailing list pyu...@li... https://lists.sourceforge.net/lists/listinfo/pyusb-users |