Changeset e1dbcbc in mainline for uspace/app/virtusbkbd/virtusbkbd.c


Ignore:
Timestamp:
2011-04-29T13:43:01Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a81a1d09
Parents:
380e0364 (diff), f19f1b7 (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.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/virtusbkbd/virtusbkbd.c

    r380e0364 re1dbcbc  
    4848#include <usb/descriptor.h>
    4949#include <usb/classes/hid.h>
     50#include <usb/debug.h>
    5051#include <usbvirt/device.h>
    51 #include <usbvirt/hub.h>
    5252
    5353#include "kbdconfig.h"
     
    6767
    6868kb_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 
    7869
    7970/** Compares current and last status of pressed keys.
     
    10091}
    10192
    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)
     93static 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)
    10496{
    10597        static uint8_t last_data[2 + KB_MAX_KEYS_AT_ONCE];
     
    122114        if (keypress_check_with_last_request(data, last_data,
    123115            2 + KB_MAX_KEYS_AT_ONCE)) {
    124                 *actual_size = 0;
    125                 return EOK;
     116                return ENAK;
    126117        }
    127118
     
    131122}
    132123
    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),
     124static 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,
    139129                .request = USB_DEVREQ_GET_DESCRIPTOR,
    140130                .name = "GetDescriptor",
    141                 .callback = stdreq_on_get_descriptor
     131                .callback = req_get_descriptor
    142132        },
    143133        {
    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        }
    153136};
    154137
     
    157140 */
    158141static 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
    162144};
    163145
     
    197179        .ops = &keyboard_ops,
    198180        .descriptors = &descriptors,
    199         .lib_debug_level = 3,
    200         .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL,
    201181        .name = "keyboard"
    202182};
     
    262242       
    263243       
    264         int rc = usbvirt_connect(&keyboard_dev);
     244        int rc = usbvirt_device_plug(&keyboard_dev, "/virt/usbhc/hc");
    265245        if (rc != EOK) {
    266246                printf("%s: Unable to start communication with VHCD (%s).\n",
     
    278258        printf("%s: Terminating...\n", NAME);
    279259       
    280         usbvirt_disconnect(&keyboard_dev);
     260        //usbvirt_disconnect(&keyboard_dev);
    281261       
    282262        return 0;
Note: See TracChangeset for help on using the changeset viewer.