Changeset 2391aaf in mainline for uspace/drv/usbhid/conv.c


Ignore:
Timestamp:
2011-02-27T19:22:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d4d98b
Parents:
c2fa801
Message:

Huge refactoring of USB HID driver.

  • Created generic USB HID device structure and API (hiddev.h/c).
    • The structure holds data common for all HID devices.
    • Functions for creating the structure, and initializing based on given endpoint description.
    • Processing of descriptors, initializing of pipes moved here.
  • Modified USB HID keyboard device structure (kbddev.h/c).
    • This structure now holds only keyboard-specific data.
    • API provides function for adding device of type keyboard.
    • All keyboard-related functions moved here. These include:
      • IPC handler
      • Key and modifier processing functions
      • Polling
      • Creating new fibril for polling.
  • Separated USB HID class-specific request functions (hidreq.h/c)
  • Removed unused code from scancode parser (conv.c)

WARNING: not compileable due to a strange error.

File:
1 edited

Legend:

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

    rc2fa801 r2391aaf  
    163163};
    164164
    165 unsigned int usbkbd_parse_scancode(int scancode)
     165unsigned int usbhid_parse_scancode(int scancode)
    166166{
    167 //      console_ev_type_t type;
    168167        unsigned int key;
    169168        int *map = scanmap_simple;
    170169        size_t map_length = sizeof(scanmap_simple) / sizeof(int);
    171 
    172         /*
    173          * ACK/NAK are returned as response to us sending a command.
    174          * We are not interested in them.
    175          */
    176 //      if (scancode == SC_ACK || scancode == SC_NAK)
    177 //              return;
    178 
    179 //      if (scancode == 0xe0) {
    180 //              ds = ds_e;
    181 //              return;
    182 //      }
    183 
    184 //      switch (ds) {
    185 //      case ds_s:
    186 //              map = scanmap_simple;
    187 //              map_length = sizeof(scanmap_simple) / sizeof(int);
    188 //              break;
    189 //      case ds_e:
    190 //              map = scanmap_e0;
    191 //              map_length = sizeof(scanmap_e0) / sizeof(int);
    192 //              break;
    193 //      default:
    194 //              map = NULL;
    195 //              map_length = 0;
    196 //      }
    197 
    198 //      ds = ds_s;
    199 
    200 //      if (scancode & 0x80) {
    201 //              scancode &= ~0x80;
    202 //              type = KEY_RELEASE;
    203 //      } else {
    204 //              type = KEY_PRESS;
    205 //      }
    206170
    207171        if ((scancode < 0) || ((size_t) scancode >= map_length))
     
    210174        key = map[scancode];
    211175       
    212         if (scancode == 0x53) {
    213                 usb_log_debug("\n\nWe have a NUM LOCK!, sending key %u\n\n", key);
    214         }
    215        
    216         if (scancode == 0x47) {
    217                 usb_log_debug("\n\nWe have a SCROLL LOCK!, sending key %u\n\n", key);
    218         }
    219        
    220         if (scancode == 0x39) {
    221                 usb_log_debug("\n\nWe have a CAPS LOCK!, sending key %u\n\n", key);
    222         }
    223        
    224 //      if (key != 0)
    225 //              kbd_push_ev(type, key);
    226176        return key;
    227177}
Note: See TracChangeset for help on using the changeset viewer.