Changes in uspace/app/virtusbkbd/virtusbkbd.c [679a135:6cb58e6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/virtusbkbd/virtusbkbd.c
r679a135 r6cb58e6 48 48 #include <usb/descriptor.h> 49 49 #include <usb/classes/hid.h> 50 #include <usb/debug.h> 50 51 #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 78 69 79 70 /** Compares current and last status of pressed keys. … … 100 91 } 101 92 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) 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) 104 96 { 105 97 static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE]; … … 122 114 if (keypress_check_with_last_request(data, last_data, 123 115 2 + KB_MAX_KEYS_AT_ONCE)) { 124 *actual_size = 0; 125 return EOK; 116 return ENAK; 126 117 } 127 118 … … 131 122 } 132 123 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), 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, 139 129 .request = USB_DEVREQ_GET_DESCRIPTOR, 140 130 .name = "GetDescriptor", 141 .callback = stdreq_on_get_descriptor131 .callback = req_get_descriptor 142 132 }, 143 133 { 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 134 .callback = NULL 135 } 153 136 }; 154 137 … … 157 140 */ 158 141 static usbvirt_device_ops_t keyboard_ops = { 159 .control_transfer_handlers = endpoint_zero_handlers, 160 .on_data = on_incoming_data, 161 .on_data_request = on_request_for_data 142 .control = endpoint_zero_handlers, 143 .data_in[1] = on_request_for_data 162 144 }; 163 145 … … 197 179 .ops = &keyboard_ops, 198 180 .descriptors = &descriptors, 199 .lib_debug_level = 3,200 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL,201 181 .name = "keyboard" 202 182 }; … … 262 242 263 243 264 int rc = usbvirt_ connect(&keyboard_dev);244 int rc = usbvirt_device_plug(&keyboard_dev, "/virt/usbhc/hc"); 265 245 if (rc != EOK) { 266 246 printf("%s: Unable to start communication with VHCD (%s).\n", … … 278 258 printf("%s: Terminating...\n", NAME); 279 259 280 usbvirt_disconnect(&keyboard_dev);260 //usbvirt_disconnect(&keyboard_dev); 281 261 282 262 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.