I am using a rPi 2B to which I have plugged in a Magstripe Card Reader (using a PS/2 to USB converter). I determined the correct Vendor/Product ID's using lsusb and then am using the following code which uses libusb to connect to the reader. This code does the check for is_kernel_driver_active
that seems to be the main source of error for this problem. Code is from the keyboard_alike project on github.
def initialize(self):
self._device = usb.core.find(idVendor=self.vendor_id, idProduct=self.product_id)
if self._device is None:
raise DeviceException('No device found, check vendor_id and product_id')
if self._device.is_kernel_driver_active(self.interface):
try:
self._device.detach_kernel_driver(self.interface)
except usb.core.USBError as e:
raise DeviceException('Could not detach kernel driver: %s' % str(e))
try:
self._device.set_configuration()
if self.should_reset:
self._device.reset()
except usb.core.USBError as e:
raise DeviceException('Could not set configuration: %s' % str(e))
self._endpoint = self._device[0][(0, 0)][0]
When executed as root, I get a Resource busy
on the call to self._device.set_configuration()
.
I have run all the updates and I am not sure what to try next.