22 Copyright (c) 2015 Osspial All Rights Reserved.
33
44 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/>.
185****************************************************************************/
196
207
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.
2411
2512extern crate hidapi;
2613
2714use hidapi:: HidApi ;
2815
2916fn main ( ) {
30-
17+
3118 let api = HidApi :: new ( ) . expect ( "Failed to create API instance" ) ;
32-
19+
3320 let joystick = api. open ( 1103 , 45320 ) . expect ( "Failed to open device" ) ;
3421
3522 loop {
@@ -41,9 +28,9 @@ fn main() {
4128 for u in & buf[ ..res] {
4229 data_string. push_str ( & ( u. to_string ( ) + "\t " ) ) ;
4330 }
44-
31+
4532
4633 println ! ( "{}" , data_string) ;
47-
34+
4835 }
49- }
36+ }
0 commit comments