Jump to content


Photo

Python+PyUSB+libusb driver


  • Please log in to reply
2 replies to this topic

#1 Robert Jordens

Robert Jordens
  • Members
  • 2 posts

Posted 12 February 2008 - 06:25 AM

Hello.

This is a rewrite of the labjack U12 driver in pure python using only the pyusb bindings for libusb.
  • No kernel driver module needed
  • will probably also work unchanged on OSX (not tested though)
  • only pyusb >= 0.4.1 required (earlier versions of pyusb are buggy)
  • everything working except: sh1tx, synch, asynch
  • speed is not an issue (16ms for standard commands, negligible CPU load)
  • feel free to improve, distribute and contribute
Have fun!

Robert.

(last update: 2008-04-23)

location: http://pypi.python.org/pypi/labjacku12

#2 David Lewis

David Lewis
  • Members
  • 1 posts

Posted 09 February 2009 - 02:28 PM

This is a rewrite of the labjack U12 driver in pure python using only the pyusb bindings for libusb.

  • No kernel driver module needed
  • will probably also work unchanged on OSX (not tested though)
  • feel free to improve, distribute and contribute

Almost. On OS X, as it turns out, the fact that the Labjack announces itself as a Human Interface Device causes the HID driver in the OS to grab it so you can't claim an interface. In poking around the libusb mailing list, I came across the solution, thanks to a programmer named Brandon Phillips. When he went back to Apple, they told him to write a null kernel driver, i.e. one that contains no code, but tells the OS that it's handling a particular device. I modified his to refer to the U12. Once it's been dropped into /System/Library/Extensions and the machine rebooted (the latter might not be necessary but I didn't check), libusb can use the U12 and your driver works. I'm attaching the project.

Best,
David

Attached File  LabjackU12_Kernel_Extension.zip   52.38KB   223 downloads

#3 Robert Jordens

Robert Jordens
  • Members
  • 2 posts

Posted 25 July 2009 - 04:10 AM

Almost. On OS X, as it turns out, the fact that the Labjack announces itself as a Human Interface Device causes the HID driver in the OS to grab it so you can't claim an interface. In poking around the libusb mailing list, I came across the solution,


Same for Linux. The HID grabs the device. One could work around that by adding some quirks to the hid module parameters.
But on Linux the following is sufficient:

try:
			self.handle.detachKernelDriver(intf)
		except usb.USBError, e:
			pass

Does that fail on OSX?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users