Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ func (d *Device) Control(rType, request uint8, val, idx uint16, data []byte) (in
return d.ctx.libusb.control(d.handle, d.ControlTimeout, rType, request, val, idx, data)
}

// DetachKernelDriver detaches the driver currently attached to the given
// interface.
func (d *Device) DetachKernelDriver(ifNumber int) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be on the Configuration rather than the Device? Once a Device is opened, you would need to select a configuration before you know what interfaces are available.

if d.handle == nil {
return fmt.Errorf("DetachKernelDriver(%d) called on %s after Close", ifNumber, d)
}
return d.ctx.libusb.detachKernelDriver(d.handle, uint8(ifNumber))
}

// Close closes the device.
func (d *Device) Close() error {
if d.handle == nil {
Expand Down