2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published
4 * by the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public
13 * License along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <libusb-1.0/libusb.h>
27 #define SHUTTLE_INTERFACE 0
29 libusb_device_handle *devsh = 0;
36 int sh_iface = SHUTTLE_INTERFACE;
37 libusb_release_interface(devsh, sh_iface);
38 libusb_attach_kernel_driver(devsh, sh_iface);
52 int ret = libusb_init(0);
55 devsh = libusb_open_device_with_vid_pid(0, 0x0b33, 0x0030);
57 int sh_iface = SHUTTLE_INTERFACE;
58 libusb_detach_kernel_driver(devsh, sh_iface);
59 ret = libusb_claim_interface(devsh, sh_iface);
60 if( ret >= 0 ) claimed = 1;
67 void sigint(int n) { done = 1; }
69 int main(int ac, char **av)
74 signal(SIGINT, sigint);
77 static const int IN_ENDPOINT = 0x81;
79 int ret = libusb_interrupt_transfer(devsh,
80 IN_ENDPOINT, dat, sizeof(dat), &len, 100);
82 if( ret == LIBUSB_ERROR_TIMEOUT ) continue;
83 printf("error: %s\n", libusb_strerror((libusb_error)ret));
87 for( int i=0; i<len; ++i ) printf(" %02x", dat[i]);