Changes in uspace/dist/src/bithenge/usbdesc.bh [71450c8:ff788c3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/dist/src/bithenge/usbdesc.bh
r71450c8 rff788c3 7 7 # Originally by Vojtech Horky. 8 8 9 # Block prefixed with a byte length10 transform block = (in.data) <- struct {11 .bLength <- uint8;12 .data <- known_length(.bLength - 1);13 };14 15 9 # USB configuration descriptor 16 10 # This is not the full configuration descriptor (i.e. with interface 17 11 # and endpoint descriptors included) but only the header. 18 12 transform usb_configuration_descriptor_bare = struct { 13 .bLength <- uint8; # assert bLength = 9 14 .bDescriptorType <- uint8; # assert: bDescriptorType == 2 19 15 .wTotalLength <- uint16le; 20 16 .bNumInterfaces <- uint8; … … 27 23 # USB interface descriptor 28 24 transform usb_interface_descriptor = struct { 25 .bLength <- uint8; # assert bLength = 9 26 .bDescriptorType <- uint8; # assert: bDescriptorType == 4 29 27 .bInterfaceNumber <- uint8; 30 28 .bAlternateSetting <- uint8; … … 38 36 # USB endpoint descriptor 39 37 transform usb_endpoint_descriptor = struct { 38 .bLength <- uint8; # assert bLength = 7 39 .bDescriptorType <- uint8; # assert: bDescriptorType == 5 40 40 .bEndpointAddress <- uint8; 41 41 .bmAttributes <- uint8; … … 46 46 # USB HID descriptor 47 47 transform usb_hid_descriptor = struct { 48 .bLength <- uint8; 49 .bDescriptorType <- uint8; # assert: bDescriptorType == 33 48 50 .bcdHID <- uint16le; 49 51 .bCountryCode <- uint8; 50 52 .bNumDescriptors <- uint8; 51 <- repeat(.bNumDescriptors) { struct { 52 .bDescriptorType <- uint8; 53 .wDescriptorLength <- uint16le; 54 } }; 53 # Following is repeated bNumDescriptors times 54 .bDescriptorType <- uint8; 55 .wDescriptorLength <- uint16le; 55 56 }; 56 57 57 # USB descriptor 58 transform usb_descriptor = struct { 59 .bDescriptorType <- uint8; 60 <- switch (.bDescriptorType) { 61 2: usb_configuration_descriptor_bare; 62 4: usb_interface_descriptor; 63 5: usb_endpoint_descriptor; 64 33: usb_hid_descriptor; 65 }; 66 } <- block; 58 # Fixed configuration for QEMU USB keyboard. 59 transform qemu_usb_keyboard = struct { 60 .configuration_descriptor <- usb_configuration_descriptor_bare; 61 .interface_descriptor <- usb_interface_descriptor; 62 .hid_descriptor <- usb_hid_descriptor; 63 .endpoint_descriptor <- usb_endpoint_descriptor; 64 }; 67 65 68 transform main = repeat { usb_descriptor };66 transform main = qemu_usb_keyboard;
Note:
See TracChangeset
for help on using the changeset viewer.