2 * Copyright (C) 2009 Ubixum, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <libusb-1.0/libusb.h>
30 libusb_context* libusb_ctx;
31 libusb_device_handle* dev_handle;
32 int interface,alt_setting;
41 * idx = nth device if there are more than one.
43 * Opens device with vid,pid and claims alt 0 of interface 0
45 void open(int vid=VID,int pid=PID, int idx=0);
46 void set_interface(int interface, int alt_setting);
47 bool isopen() { return dev_handle != NULL; }
52 void set_debug_level(int n);
53 int do_usb_command(char* buf, int size, unsigned char type, unsigned char request, unsigned short value, unsigned short index, unsigned short length, int timeout=1000 );
54 int clear_halt(char ep);
56 int set_configuration(int config);
57 bool ep_bulk(char* buf, int size, unsigned char ep, int timeout);