8 #include <libusb-1.0/libusb.h>
10 #define SHUTTLE_INTERFACE 0
12 libusb_device_handle *devsh = 0;
19 int sh_iface = SHUTTLE_INTERFACE;
20 libusb_release_interface(devsh, sh_iface);
21 libusb_attach_kernel_driver(devsh, sh_iface);
35 int ret = libusb_init(0);
38 devsh = libusb_open_device_with_vid_pid(0, 0x0b33, 0x0030);
40 int sh_iface = SHUTTLE_INTERFACE;
41 libusb_detach_kernel_driver(devsh, sh_iface);
42 ret = libusb_claim_interface(devsh, sh_iface);
43 if( ret >= 0 ) claimed = 1;
50 void sigint(int n) { done = 1; }
52 int main(int ac, char **av)
57 signal(SIGINT, sigint);
60 static const int IN_ENDPOINT = 0x81;
62 int ret = libusb_interrupt_transfer(devsh,
63 IN_ENDPOINT, dat, sizeof(dat), &len, 100);
65 if( ret == LIBUSB_ERROR_TIMEOUT ) continue;
66 printf("error: %s\n", libusb_strerror((libusb_error)ret));
70 for( int i=0; i<len; ++i ) printf(" %02x", dat[i]);