Skip to content Skip to sidebar Skip to footer

Pyusb Device Claimed, Detach_kernel_driver Return Entity Not Found

I'm attempting to do bulk reads and writes from a USB device on Ubuntu using PyUSB. However, i've been unsuccessful at getting that far. import usb.core import usb.util dev = usb

Solution 1:

Your problem, like mine, is that you need to detach the kernel from each and every interface before you can set_configuration(). Here's the code I am using right now (including some scaffolding) for connecting to a USB audio device:

import usb.core
import usb.util

scarlet = usb.core.find(idVendor = 0x1235)  # Focusrite
if not scarlet: print"No Scarlet"

c = 1
for config in scarlet:
    print 'config', c
    print 'Interfaces', config.bNumInterfaces
    for i in range(config.bNumInterfaces):
        if scarlet.is_kernel_driver_active(i):
            scarlet.detach_kernel_driver(i)
        print i
    c+=1

scarlet.set_configuration()

Post a Comment for "Pyusb Device Claimed, Detach_kernel_driver Return Entity Not Found"