From f0723285e05157c0d1e669b16bcaa60803da0835 Mon Sep 17 00:00:00 2001 From: Adrian Kumpf Date: Wed, 3 Jan 2018 11:47:36 +0100 Subject: [PATCH] Add function to read the port number of a device --- src/device.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/device.rs b/src/device.rs index cbfda2b..fb38b4a 100644 --- a/src/device.rs +++ b/src/device.rs @@ -57,6 +57,11 @@ impl<'a> Device<'a> { Ok(unsafe { config_descriptor::from_libusb(config) }) } + /// Returns the number of the port that the device is connected to. + pub fn port_number(&self) -> u8 { + unsafe { libusb_get_port_number(self.device) } + } + /// Returns the number of the bus that the device is connected to. pub fn bus_number(&self) -> u8 { unsafe {