Changeset 243cb86 in mainline for uspace/drv/usbkbd/main.c
- Timestamp:
- 2010-12-12T10:50:19Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8365533
- Parents:
- 101ef25c (diff), ebb98c5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/main.c
r101ef25c r243cb86 32 32 #include <fibril.h> 33 33 #include <usb/classes/hid.h> 34 #include <usb/classes/hidparser.h> 35 #include <usb/devreq.h> 34 36 35 37 #define BUFFER_SIZE 32 … … 37 39 38 40 static const usb_endpoint_t CONTROL_EP = 0; 41 42 /* 43 * Callbacks for parser 44 */ 45 static void usbkbd_process_keycodes(const uint16_t *key_codes, size_t count, 46 void *arg) 47 { 48 49 } 50 51 /* 52 * Kbd functions 53 */ 54 static int usbkbd_get_descriptors() 55 { 56 // copy-pasted: 57 58 /* Prepare the setup packet. */ 59 usb_device_request_setup_packet_t setup_packet = { 60 .request_type = 128, 61 .request = USB_DEVREQ_GET_DESCRIPTOR, 62 .index = 0, 63 .length = sizeof(usb_standard_device_descriptor_t) 64 }; 65 66 setup_packet.value_high = USB_DESCTYPE_DEVICE; 67 setup_packet.value_low = 0; 68 69 /* Prepare local descriptor. */ 70 size_t actually_transferred = 0; 71 usb_standard_device_descriptor_t descriptor_tmp; 72 73 /* Perform the control read transaction. */ 74 int rc = usb_drv_psync_control_read(phone, target, 75 &setup_packet, sizeof(setup_packet), 76 &descriptor_tmp, sizeof(descriptor_tmp), &actually_transferred); 77 78 if (rc != EOK) { 79 return rc; 80 } 81 82 // end of copy-paste 83 } 39 84 40 85 static usb_hid_dev_kbd_t *usbkbd_init_device(device_t *dev) … … 68 113 69 114 // TODO: get descriptors 70 115 usbkbd_get_descriptors(); 71 116 // TODO: parse descriptors and save endpoints 72 117 … … 75 120 76 121 static void usbkbd_process_interrupt_in(usb_hid_dev_kbd_t *kbd_dev, 77 char*buffer, size_t actual_size)122 uint8_t *buffer, size_t actual_size) 78 123 { 79 124 /* … … 81 126 * now only take last 6 bytes and process, i.e. send to kbd 82 127 */ 128 129 usb_hid_report_in_callbacks_t *callbacks = 130 (usb_hid_report_in_callbacks_t *)malloc( 131 sizeof(usb_hid_report_in_callbacks_t)); 132 callbacks->keyboard = usbkbd_process_keycodes; 133 134 usb_hid_parse_report(kbd_dev->parser, buffer, callbacks, NULL); 83 135 } 84 136 … … 87 139 int rc; 88 140 usb_handle_t handle; 89 charbuffer[BUFFER_SIZE];141 uint8_t buffer[BUFFER_SIZE]; 90 142 size_t actual_size; 91 143 //usb_endpoint_t poll_endpoint = 1;
Note:
See TracChangeset
for help on using the changeset viewer.