Magstripe Card Reader(PS/2 to USBコンバータを使用)を差し込んだrPi 2Bを使用しています。私は、lsusbを使ってベンダー/プロダクトIDを決め、次にlibusbを使ってリーダーに接続する次のコードを使っています。このコードは、この問題の主なエラーの原因と思われるis_kernel_driver_active
のチェックを行います。コードはgithubのkeyboard_alikeプロジェクトからのものです。 rootとして実行する場合LibUSB ErrNo 16リソース使用中 - マガジンリーダー
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]
、私はself._device.set_configuration()
への呼び出しにResource busy
を取得します。
私はすべてのアップデートを実行しましたが、次に何を試していいのか分かりません。