USB Missile.

Bobby bob131 at pookmail.com
Wed Dec 27 09:48:11 EST 2006


I am trying to create a python version of the M&S USB Missile Launcher
code for Windows.

I am basing it off one designed for linux.

I note the following about dependencies:

Requirements:
-------------
  0. python (>=2.3)
            -Fine
  1. libusb (>=0.1.2)
            -Fine, however the windows version has the following note:
               If you are porting a libusb based program from Unix
style systems to Windows, remove all references to the library's global
variable usb_busses. Use the function usb_get_busses()  instead to get
this variable. Global variables in shared libraries (DLLs) do not work
on Windows systems across different compilers.
  2. pyusb (==0.3.1) python module with patch (to enable kernel
detachment)
             -Fine, besides patch since this does not seem to be
windows compatible (patch is hosted at
http://scott.weston.id.au/software/pymissile/pyusb-0.3.1-kernel-detach.patch)
  3. urwid python module
             -Fine

I am trying to use the following code at
http://scott.weston.id.au/software/pymissile/missile.py but with the
following lines removed due to the patch above not being applied:
    self.handle.detachKernelDriver(0)
    self.handle.detachKernelDriver(1)

It loads okay, but gives the following error:

Traceback (most recent call last):
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 367, in
?
    main(sys.argv[1:])
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 361, in
main
    MissileDisplay().main()
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 156, in
main
    self.ui.run_wrapper(self.run)
  File "C:\Python24\lib\urwid\curses_display.py", line 179, in
run_wrapper
    return fn()
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 197, in
run
    m.move(MissileDevice.LEFTUP)
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 83, in
move
    self.dev.handle.controlMsg(0x21, 0x09, self.INITA, 0x02, 0x01)
usb.USBError: usb_control_msg: sending control message failed, win
error: The de
vice does not recognize the command.


Does anyone have any ideas of how to solve this error? I thought it
might have something to do with
    busses = usb.busses()
in the python, but libusb requiring the function usb_get_busses() to be
used to obtain the usb_busses variable.

I don't however have much python experience.

Thanks.




More information about the Python-list mailing list