2
2
Copyright (c) 2015 Osspial All Rights Reserved.
3
3
4
4
This file is part of hidapi-rs, based on hidapi_rust by Roland Ruckerbauer.
5
-
6
- hidapi-rs is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- hidapi-rs is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with hidapi-rs. If not, see <http://www.gnu.org/licenses/>.
18
5
****************************************************************************/
19
6
20
7
21
- //! Opens a Thrustmaster T-Flight HOTAS X HID and reads data from it. This
22
- //! example will not work unless such an HID is plugged in to your system.
23
- //! Will update in the future to support all HIDs.
8
+ //! Opens a Thrustmaster T-Flight HOTAS X HID and reads data from it. This
9
+ //! example will not work unless such an HID is plugged in to your system.
10
+ //! Will update in the future to support all HIDs.
24
11
25
12
extern crate hidapi;
26
13
27
14
use hidapi:: HidApi ;
28
15
29
16
fn main ( ) {
30
-
17
+
31
18
let api = HidApi :: new ( ) . expect ( "Failed to create API instance" ) ;
32
-
19
+
33
20
let joystick = api. open ( 1103 , 45320 ) . expect ( "Failed to open device" ) ;
34
21
35
22
loop {
@@ -41,9 +28,9 @@ fn main() {
41
28
for u in & buf[ ..res] {
42
29
data_string. push_str ( & ( u. to_string ( ) + "\t " ) ) ;
43
30
}
44
-
31
+
45
32
46
33
println ! ( "{}" , data_string) ;
47
-
34
+
48
35
}
49
- }
36
+ }
0 commit comments