1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
pub mod types {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
pub mod ioctl {
use nix::*;
use crate::types::*;
ioctl_read!(control, 'U', 0, ctrltransfer);
ioctl_read!(bulk, 'U', 2, bulktransfer);
ioctl_read!(resetep, 'U', 3, ::std::os::raw::c_uint);
ioctl_read!(setinterface, 'U', 4, setinterface);
ioctl_read!(setconfiguration, 'U', 5, ::std::os::raw::c_uint);
ioctl_write_ptr!(getdriver, 'U', 8, getdriver);
ioctl_read!(submiturb, 'U', 10, urb);
ioctl_none!(discardurb, 'U', 11);
ioctl_write_ptr!(reapurb, 'U', 12, *mut ::std::os::raw::c_void);
ioctl_write_ptr!(reapurbndelay, 'U', 13, *mut ::std::os::raw::c_void);
ioctl_read!(discsignal, 'U', 14, disconnectsignal);
ioctl_read!(
claiminterface, 'U', 15, ::std::os::raw::c_uint
);
ioctl_read!(
releaseinterface, 'U', 16, ::std::os::raw::c_uint
);
ioctl_write_ptr!(connectinfo, 'U', 17, connectinfo);
ioctl_readwrite!(ioctl, 'U', 18, ioctl);
ioctl_read!(hub_portinfo, 'U', 19, hub_portinfo);
ioctl_none!(reset, 'U', 20);
ioctl_read!(clear_halt, 'U', 21, ::std::os::raw::c_uint);
pub unsafe fn disconnect(fd: ::std::os::raw::c_int, ifno: ::std::os::raw::c_int) -> Result<i32> {
let mut req = crate::types::ioctl {
ifno,
ioctl_code: request_code_none!('U', 22) as i32,
data: std::ptr::null_mut(),
};
ioctl(fd, &mut req)
}
pub unsafe fn connect(fd: ::std::os::raw::c_int, ifno: ::std::os::raw::c_int) -> Result<i32>{
let mut req = crate::types::ioctl {
ifno,
ioctl_code: request_code_none!('U', 23) as i32,
data: std::ptr::null_mut(),
};
ioctl(fd, &mut req)
}
ioctl_read!(claim_port, 'U', 24, ::std::os::raw::c_uint);
ioctl_read!(release_port, 'U', 25, ::std::os::raw::c_uint);
ioctl_read!(
get_capabilities, 'U', 26, __u32
);
ioctl_read!(disconnect_claim, 'U', 27, disconnect_claim);
ioctl_read!(alloc_streams, 'U', 28, streams);
ioctl_read!(free_streams, 'U', 29, streams);
ioctl_write_ptr!(drop_privileges, 'U', 30, __u32);
}
#[cfg(test)]
mod tests {
}