Changes in uspace/app/virtusbkbd/virtusbkbd.c [6cb58e6:679a135] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/virtusbkbd/virtusbkbd.c
r6cb58e6 r679a135 48 48 #include <usb/descriptor.h> 49 49 #include <usb/classes/hid.h> 50 #include <usb/debug.h>51 50 #include <usbvirt/device.h> 51 #include <usbvirt/hub.h> 52 52 53 53 #include "kbdconfig.h" … … 67 67 68 68 kb_status_t status; 69 70 static int on_incoming_data(struct usbvirt_device *dev, 71 usb_endpoint_t endpoint, void *buffer, size_t size) 72 { 73 printf("%s: ignoring incomming data to endpoint %d\n", NAME, endpoint); 74 75 return EOK; 76 } 77 69 78 70 79 /** Compares current and last status of pressed keys. … … 91 100 } 92 101 93 static int on_request_for_data(usbvirt_device_t *dev, 94 usb_endpoint_t endpoint, usb_transfer_type_t transfer_type, 95 void *buffer, size_t size, size_t *actual_size) 102 static int on_request_for_data(struct usbvirt_device *dev, 103 usb_endpoint_t endpoint, void *buffer, size_t size, size_t *actual_size) 96 104 { 97 105 static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE]; … … 114 122 if (keypress_check_with_last_request(data, last_data, 115 123 2 + KB_MAX_KEYS_AT_ONCE)) { 116 return ENAK; 124 *actual_size = 0; 125 return EOK; 117 126 } 118 127 … … 122 131 } 123 132 124 static usbvirt_control_request_handler_t endpoint_zero_handlers[] = { 125 { 126 .req_direction = USB_DIRECTION_IN, 127 .req_type = USB_REQUEST_TYPE_STANDARD, 128 .req_recipient = USB_REQUEST_RECIPIENT_INTERFACE, 133 static usbvirt_control_transfer_handler_t endpoint_zero_handlers[] = { 134 { 135 .request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE( 136 USB_DIRECTION_IN, 137 USBVIRT_REQUEST_TYPE_STANDARD, 138 USBVIRT_REQUEST_RECIPIENT_DEVICE), 129 139 .request = USB_DEVREQ_GET_DESCRIPTOR, 130 140 .name = "GetDescriptor", 131 .callback = req_get_descriptor 132 }, 133 { 134 .callback = NULL 135 } 141 .callback = stdreq_on_get_descriptor 142 }, 143 { 144 .request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE( 145 USB_DIRECTION_IN, 146 USBVIRT_REQUEST_TYPE_CLASS, 147 USBVIRT_REQUEST_RECIPIENT_DEVICE), 148 .request = USB_DEVREQ_GET_DESCRIPTOR, 149 .name = "GetDescriptor", 150 .callback = stdreq_on_get_descriptor 151 }, 152 USBVIRT_CONTROL_TRANSFER_HANDLER_LAST 136 153 }; 137 154 … … 140 157 */ 141 158 static usbvirt_device_ops_t keyboard_ops = { 142 .control = endpoint_zero_handlers, 143 .data_in[1] = on_request_for_data 159 .control_transfer_handlers = endpoint_zero_handlers, 160 .on_data = on_incoming_data, 161 .on_data_request = on_request_for_data 144 162 }; 145 163 … … 179 197 .ops = &keyboard_ops, 180 198 .descriptors = &descriptors, 199 .lib_debug_level = 3, 200 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL, 181 201 .name = "keyboard" 182 202 }; … … 242 262 243 263 244 int rc = usbvirt_ device_plug(&keyboard_dev, "/virt/usbhc/hc");264 int rc = usbvirt_connect(&keyboard_dev); 245 265 if (rc != EOK) { 246 266 printf("%s: Unable to start communication with VHCD (%s).\n", … … 258 278 printf("%s: Terminating...\n", NAME); 259 279 260 //usbvirt_disconnect(&keyboard_dev);280 usbvirt_disconnect(&keyboard_dev); 261 281 262 282 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.