Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 78bfae9 in mainline


Ignore:
Timestamp:
2011-05-17T22:28:03Z (11 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master
Children:
df44fa2
Parents:
4880210
Message:

Running generic HID driver for each device

Location:
uspace/drv/usbhid
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/subdrivers.c

    r4880210 r78bfae9  
    3838#include "usb/classes/hidpath.h"
    3939
    40 //#include "lgtch-ultrax/lgtch-ultrax.h"
    4140#include "multimedia/multimedia.h"
    4241#include "mouse/mousedev.h"
     42#include "generic/hiddev.h"
    4343
    4444static usb_hid_subdriver_usage_t path_kbd[] = {
     
    5858};
    5959
     60static usb_hid_subdriver_usage_t generic_hid_key_path[] = {
     61        {0, 0}
     62};
     63
    6064const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = {
    6165        {
    6266                path_kbd,
    63                 -1,
     67                0,
    6468                USB_HID_PATH_COMPARE_BEGIN,
    6569                -1,
     
    8892        {
    8993                path_mouse,
    90                 -1,
     94                0,
    9195                USB_HID_PATH_COMPARE_BEGIN,
    9296                -1,
     
    99103                }
    100104        },
     105        {
     106                generic_hid_key_path,
     107                0,
     108                USB_HID_PATH_COMPARE_ANYWHERE,
     109                -1,
     110                -1,
     111                {
     112                        .init = usb_generic_hid_init,
     113                        .deinit = NULL,
     114                        .poll = usb_generic_hid_polling_callback,
     115                        .poll_end = NULL
     116                }
     117        },
    101118        {NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL, NULL}}
    102119};
  • uspace/drv/usbhid/usbhid.c

    r4880210 r78bfae9  
    234234        }
    235235       
    236         hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc(count *
     236        // add one generic HID subdriver per device
     237       
     238        hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc((count + 1) *
    237239            sizeof(usb_hid_subdriver_t));
    238240        if (hid_dev->subdrivers == NULL) {
     
    247249        }
    248250       
    249         hid_dev->subdriver_count = count;
     251        hid_dev->subdrivers[count].init = usb_generic_hid_init;
     252        hid_dev->subdrivers[count].poll = usb_generic_hid_polling_callback;
     253        hid_dev->subdrivers[count].deinit = NULL;
     254        hid_dev->subdrivers[count].poll_end = NULL;
     255       
     256        hid_dev->subdriver_count = count + 1;
    250257       
    251258        return EOK;
Note: See TracChangeset for help on using the changeset viewer.