|
1 | 1 | use std::time::Duration;
|
2 |
| -use libusb::*; |
| 2 | +use rusb::*; |
3 | 3 | use usb_device::test_class;
|
4 | 4 |
|
5 | 5 | pub const TIMEOUT: Duration = Duration::from_secs(1);
|
6 | 6 | pub const EN_US: u16 = 0x0409;
|
7 | 7 |
|
8 |
| -pub struct DeviceHandles<'a> { |
| 8 | +pub struct DeviceHandles { |
9 | 9 | pub device_descriptor: DeviceDescriptor,
|
10 | 10 | pub config_descriptor: ConfigDescriptor,
|
11 |
| - pub handle: DeviceHandle<'a>, |
| 11 | + pub handle: DeviceHandle<Context>, |
12 | 12 | pub en_us: Language,
|
13 | 13 | }
|
14 | 14 |
|
15 |
| -impl<'a> ::std::ops::Deref for DeviceHandles<'a> { |
16 |
| - type Target = DeviceHandle<'a>; |
| 15 | +impl ::std::ops::Deref for DeviceHandles { |
| 16 | + type Target = DeviceHandle<Context>; |
17 | 17 |
|
18 |
| - fn deref(&self) -> &DeviceHandle<'a> { |
| 18 | + fn deref(&self) -> &DeviceHandle<Context> { |
19 | 19 | &self.handle
|
20 | 20 | }
|
21 | 21 | }
|
22 | 22 |
|
23 |
| -impl<'a> ::std::ops::DerefMut for DeviceHandles<'a> { |
24 |
| - fn deref_mut(&mut self) -> &mut DeviceHandle<'a> { |
| 23 | +impl ::std::ops::DerefMut for DeviceHandles { |
| 24 | + fn deref_mut(&mut self) -> &mut DeviceHandle<Context> { |
25 | 25 | &mut self.handle
|
26 | 26 | }
|
27 | 27 | }
|
28 | 28 |
|
29 |
| -pub fn open_device(ctx: &Context) -> libusb::Result<DeviceHandles<'_>> { |
| 29 | +pub fn open_device(ctx: &Context) -> rusb::Result<DeviceHandles> { |
30 | 30 | for device in ctx.devices()?.iter() {
|
31 | 31 | let device_descriptor = device.device_descriptor()?;
|
32 | 32 |
|
@@ -58,5 +58,5 @@ pub fn open_device(ctx: &Context) -> libusb::Result<DeviceHandles<'_>> {
|
58 | 58 | }
|
59 | 59 | }
|
60 | 60 |
|
61 |
| - Err(libusb::Error::NoDevice) |
| 61 | + Err(rusb::Error::NoDevice) |
62 | 62 | }
|
0 commit comments