ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/SteeringWheelRemote/SteeringWheelRemote.cpp
Revision: 1
Committed: 2007-04-25T18:29:45-07:00 (15 years, 5 months ago) by douglas
File size: 730 byte(s)
Log Message:
Stuffs!

File Contents

# User Rev Content
1 douglas 1 // Steering Wheel Remote
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include <cassert>
8     #include <iostream>
9     #include <sstream>
10     #include <string>
11    
12     #include <dev/usb/usb.h>
13     #include <dev/usb/usbhid.h>
14     #include <fcntl.h>
15     #include <sys/ioctl.h>
16     #include <usbhid.h>
17    
18     int main(int argc, char *argv[])
19     {
20     for (unsigned number(0); true; ++number)
21     {
22     std::ostringstream device;
23    
24     device << "/dev/usb" << number;
25    
26     int usb(::open(device.str().c_str(), O_RDONLY));
27    
28     if (usb == -1)
29     break;
30    
31     usb_device_info info;
32    
33     info.udi_addr = 1;
34    
35     assert(::ioctl(usb, USB_DEVICEINFO, &info) != -1);
36    
37     for (unsigned port(0); port != info.udi_nports; ++port)
38     std::cerr << unsigned(info.udi_ports[port]) << std::endl;
39    
40     ::close(usb);
41     }
42    
43     return 0;
44     }

Properties

Name Value
svn:keywords Id