Skip to content

Commit

Permalink
append _0 to max_packet_size
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Aug 9, 2024
1 parent 9fd90b6 commit cf2ecf0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub struct DeviceInfo {
pub(crate) subclass: u8,
pub(crate) protocol: u8,

pub(crate) max_packet_size: u8,
pub(crate) max_packet_size_0: u8,

pub(crate) speed: Option<Speed>,

Expand Down Expand Up @@ -191,8 +191,8 @@ impl DeviceInfo {

/// Maximum packet size for endpoint zero.
#[doc(alias = "bMaxPacketSize0")]
pub fn max_packet_size(&self) -> u8 {
self.max_packet_size
pub fn max_packet_size_0(&self) -> u8 {
self.max_packet_size_0
}

/// Connection speed
Expand Down Expand Up @@ -272,7 +272,7 @@ impl std::fmt::Debug for DeviceInfo {
.field("class", &format_args!("0x{:02X}", self.class))
.field("subclass", &format_args!("0x{:02X}", self.subclass))
.field("protocol", &format_args!("0x{:02X}", self.protocol))
.field("max_packet_size", &self.max_packet_size)
.field("max_packet_size_0", &self.max_packet_size_0)
.field("speed", &self.speed)
.field("manufacturer_string", &self.manufacturer_string)
.field("product_string", &self.product_string)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux_usbfs/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub fn probe_device(path: SysfsPath) -> Result<DeviceInfo, SysfsError> {
class: path.read_attr_hex("bDeviceClass")?,
subclass: path.read_attr_hex("bDeviceSubClass")?,
protocol: path.read_attr_hex("bDeviceProtocol")?,
max_packet_size: path.read_attr("bMaxPacketSize0")?,
max_packet_size_0: path.read_attr("bMaxPacketSize0")?,
speed: path
.read_attr::<String>("speed")
.ok()
Expand Down
2 changes: 1 addition & 1 deletion src/platform/macos_iokit/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) fn probe_device(device: IoService) -> Option<DeviceInfo> {
class: get_integer_property(&device, "bDeviceClass")? as u8,
subclass: get_integer_property(&device, "bDeviceSubClass")? as u8,
protocol: get_integer_property(&device, "bDeviceProtocol")? as u8,
max_packet_size: get_integer_property(&device, "bMaxPacketSize0")? as u8,
max_packet_size_0: get_integer_property(&device, "bMaxPacketSize0")? as u8,
speed: get_integer_property(&device, "Device Speed").and_then(map_speed),
manufacturer_string: get_string_property(&device, "USB Vendor Name"),
product_string: get_string_property(&device, "USB Product Name"),
Expand Down
2 changes: 1 addition & 1 deletion src/platform/windows_winusb/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub fn probe_device(devinst: DevInst) -> Option<DeviceInfo> {
class: info.device_desc.bDeviceClass,
subclass: info.device_desc.bDeviceSubClass,
protocol: info.device_desc.bDeviceProtocol,
max_packet_size: info.device_desc.bMaxPacketSize0,
max_packet_size_0: info.device_desc.bMaxPacketSize0,
speed: info.speed,
manufacturer_string: None,
product_string,
Expand Down

0 comments on commit cf2ecf0

Please sign in to comment.