2 * (C) 2006 by Frank Zirkelbach <hackbard@hackdaworld.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 struct gemtag_handle {
30 struct usb_dev_handle *handle;
35 struct usb_device *find_device(unsigned short vendor, unsigned short device) {
38 struct usb_device *dev;
44 if(dev->descriptor.idVendor==vendor &&
45 dev->descriptor.idProduct==device)
54 struct gemtag_handle *gemtag_open(void) {
55 struct usb_device *gemtag;
56 unsigned char rbuf[16];
58 unsigned int i,numconf;
59 unsigned int j,numint;
60 struct gemtag_handle *gh;
68 gemtag=find_device(USB_VENDOR_GEMTAG, USB_DEVICE_X501);
69 if(!gemtag) return NULL;
71 gh=malloc(sizeof(struct gemtag_handle));
74 memset(gh,0,sizeof(struct gemtag_handle));
76 numconf=gemtag->descriptor.bNumConfigurations;
77 printf("found gemtag, %u configurations\n",numconf);
78 for(i=0;i<numconf;i++) {
79 numint=gemtag->config[i].bNumInterfaces;
80 printf("config %u [nr %u] has %u interfaces\n",
81 i,gemtag->config[i].bConfigurationValue,
83 for(j=0;j<numint;j++) {
84 printf("config %u interface %u has %u altsettings\n",
85 i,j,gemtag->config[i].interface[j].num_altsetting);
89 gh->handle=usb_open(gemtag);
98 int main(int argc, char **argv) {
100 struct gemtag_handle *gh;