]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/usb/usb-unix.factor
Initial import
[factor.git] / unmaintained / usb / usb-unix.factor
1 ! Copyright (C) 2006 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 !
4 IN: usb
5 USING: kernel alien ;
6
7 "usb" "libusb.so" "cdecl" add-library
8
9 LIBRARY: usb
10
11 C-STRUCT: usb_bus
12     { "void*" "next" }
13     { "void*" "prev" }
14     { { "char" 4097 } "dirname" }
15     { "void*" "devices" }
16     { "uint" "location" }
17     { "void*" "root_dev" } ;
18
19 ! __attribute__ ((packed))
20 C-STRUCT: usb_device_descriptor
21     { +packed+ "uchar" "bLength" }
22     { +packed+ "uchar" "bDescriptorType" }
23     { +packed+ "ushort" "bcdUSB" }
24     { +packed+ "uchar" "bDeviceClass" }
25     { +packed+ "uchar" "bDeviceSubClass" }
26     { +packed+ "uchar" "bDeviceProtocol" }
27     { +packed+ "uchar" "bMaxPacketSize0" }
28     { +packed+ "ushort" "idVendor" }
29     { +packed+ "ushort" "idProduct" }
30     { +packed+ "ushort" "bcdDevice" }
31     { +packed+ "uchar" "iManufacturer" }
32     { +packed+ "uchar" "iProduct" }
33     { +packed+ "uchar" "iSerialNumber" }
34     { +packed+ "uchar" "bNumConfigurations" } ;
35
36 C-STRUCT: usb_config_descriptor
37     { +packed+ "uchar" "bLength" }
38     { +packed+ "uchar" "bDescriptorType" }
39     { +packed+ "ushort" "wTotalLength" }
40     { +packed+ "uchar" "bNumInterfaces" }
41     { +packed+ "uchar" "bConfigurationValue" }
42     { +packed+ "uchar" "iConfiguration" }
43     { +packed+ "uchar" "bmAttributes" }
44     { +packed+ "uchar" "MaxPower" }
45     
46     { "void*" "interface" }
47     
48     { "uchar*" "extra" }
49     { "int" "extralen" } ;
50
51 C-STRUCT: usb_device
52     { "void*" "next" }
53     { "void*" "prev" }
54     { { "char" 4097 } "filename" }
55     { "usb_bus*" "bus" }
56     { "usb_device_descriptor" "descriptor" }
57     { "usb_config_descriptor*" "config" }
58     { "void*" "dev" }
59     { "uchar" "devnum" }
60     { "uchar" "num_children" }
61     { "void*" "children" } ;