windows: Fix interface busy check
This commit is contained in:
parent
4009138dc7
commit
64a278bd41
2 changed files with 7 additions and 7 deletions
|
|
@ -242,7 +242,7 @@ impl BitSet256 {
|
|||
1u64 << (bit % 64)
|
||||
}
|
||||
|
||||
fn is_set(&mut self, bit: u8) -> bool {
|
||||
fn is_set(&self, bit: u8) -> bool {
|
||||
self.0[Self::idx(bit)] & Self::mask(bit) != 0
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ impl WinusbFileHandle {
|
|||
assert!(interface_number >= self.first_interface);
|
||||
|
||||
if self.claimed_interfaces.is_set(interface_number) {
|
||||
Error::new(ErrorKind::Busy, "interface is already claimed");
|
||||
return Err(Error::new(ErrorKind::Busy, "interface is already claimed"));
|
||||
}
|
||||
|
||||
let winusb_handle = if self.first_interface == interface_number {
|
||||
|
|
@ -320,8 +320,8 @@ impl WinusbFileHandle {
|
|||
if WinUsb_GetAssociatedInterface(self.winusb_handle, idx, &mut out_handle) == FALSE
|
||||
{
|
||||
let err = GetLastError();
|
||||
error!(
|
||||
"WinUsb_GetAssociatedInterface for {} on {} failed: {:?}",
|
||||
debug!(
|
||||
"WinUsb_GetAssociatedInterface for interface {} using handle for {} failed: {:?}",
|
||||
interface_number, self.first_interface, err
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ use std::ffi::{OsStr, OsString};
|
|||
use log::debug;
|
||||
use windows_sys::Win32::Devices::{
|
||||
Properties::{
|
||||
DEVPKEY_Device_Address, DEVPKEY_Device_BusReportedDeviceDesc, DEVPKEY_Device_CompatibleIds,
|
||||
DEVPKEY_Device_DeviceDesc, DEVPKEY_Device_HardwareIds, DEVPKEY_Device_InstanceId,
|
||||
DEVPKEY_Device_LocationPaths, DEVPKEY_Device_Parent, DEVPKEY_Device_Service,
|
||||
DEVPKEY_Device_Address, DEVPKEY_Device_BusReportedDeviceDesc, DEVPKEY_Device_DeviceDesc,
|
||||
DEVPKEY_Device_HardwareIds, DEVPKEY_Device_InstanceId, DEVPKEY_Device_LocationPaths,
|
||||
DEVPKEY_Device_Parent, DEVPKEY_Device_Service,
|
||||
},
|
||||
Usb::{GUID_DEVINTERFACE_USB_DEVICE, GUID_DEVINTERFACE_USB_HUB},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue