philenotfound / usbmailnotifier

Automatically exported from code.google.com/p/usbmailnotifier
0 stars 0 forks source link

>python setcolor.py 5 fails on windows with libusb-win32 #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I tried to get the setcolor.py script working under windows 7 but without 
success.

A) PREPARATION
I installed the following modules
- usb
- libusb-win32

To verify the installation I tried to find the usb mail notifier in a python 
shell. This works successfully with:
>>> import usb.core
>>> dev = usb.core.find(idVendor=0x1d34, idProduct=0x0004)
>>> print dev
<usb.core.Device object at 0x023BB750>

B) EXECUTION FAILURE
But I'm not able to get the setcolor.py script working. It failes with the 
follwoing messages:
C:\Users\dieterled\Desktop\Neuer Ordner>python setcolor.py 5
Traceback (most recent call last):
  File "setcolor.py", line 60, in <module>
    main(sys.argv)
  File "setcolor.py", line 57, in main
    m.setColor(int(argv[1]))
  File "setcolor.py", line 18, in setColor
    self.dev.handle.interruptWrite(0x02, self.makeData(color), 1000)
  File "C:\Python27\lib\site-packages\usb\legacy.py", line 171, in interruptWrite
    return self.dev.write(endpoint, buffer, self.__claimed_interface, timeout)
  File "C:\Python27\lib\site-packages\usb\core.py", line 624, in write
    intf = self._ctx.get_interface(self, interface)
  File "C:\Python27\lib\site-packages\usb\core.py", line 150, in get_interface
    cfg = self.get_active_configuration(device)
  File "C:\Python27\lib\site-packages\usb\core.py", line 165, in get_active_configuration
    bConfigurationValue=self.backend.get_configuration(self.handle)
  File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 464, in get_configuration
    100
  File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 544, in ctrl_transfer
    timeout
  File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 392, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending control 
message failed, win error: Das System kann
 die angegebene Datei nicht finden.

The last german message means: The system can not find the given file.

C) SOLUTION
To get it working under windows 7 I wrote a new class for the usb mail notifier 
based on the pywinusb module. The steps to get it working are:
1. Deinstall libusb-win32 driver
2. Install the default windows driver for the usb mail notifier
3. Install the pywinusb module (this may require to install additional python 
modules/packages)
4. Install the usbMailNotifier.py module attached to this issue.

Original issue reported on code.google.com by dieterle...@gmail.com on 29 Nov 2013 at 9:53

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
usbMailNotifier-1.0.3.zip attached.

I have forgotten the USB Mail Notifier initialization sequence.

dad.

Original comment by dieterle...@gmail.com on 29 Nov 2013 at 1:01

Attachments: