Changeset 323b0ec in mainline for uspace/drv/usbhid/kbd/kbddev.c


Ignore:
Timestamp:
2011-04-29T09:29:47Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b20de1d
Parents:
956e8ea
Message:

Fixed usb_kbd_free() and usb_kbd_deinit()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/kbd/kbddev.c

    r956e8ea r323b0ec  
    203203/*----------------------------------------------------------------------------*/
    204204/** Mapping of USB modifier key codes to generic modifier key codes. */
    205 static const keycode_t usbhid_modifiers_keycodes[USB_HID_MOD_COUNT] = {
    206         KC_LCTRL,         /* USB_HID_MOD_LCTRL */
    207         KC_LSHIFT,        /* USB_HID_MOD_LSHIFT */
    208         KC_LALT,          /* USB_HID_MOD_LALT */
    209         0,                /* USB_HID_MOD_LGUI */
    210         KC_RCTRL,         /* USB_HID_MOD_RCTRL */
    211         KC_RSHIFT,        /* USB_HID_MOD_RSHIFT */
    212         KC_RALT,          /* USB_HID_MOD_RALT */
    213         0,                /* USB_HID_MOD_RGUI */
    214 };
    215 
    216 typedef enum usbhid_lock_code {
    217         USB_KBD_LOCK_NUM = 0x53,
    218         USB_KBD_LOCK_CAPS = 0x39,
    219         USB_KBD_LOCK_SCROLL = 0x47,
    220         USB_KBD_LOCK_COUNT = 3
    221 } usbhid_lock_code;
    222 
    223 static const usbhid_lock_code usbhid_lock_codes[USB_KBD_LOCK_COUNT] = {
    224         USB_KBD_LOCK_NUM,
    225         USB_KBD_LOCK_CAPS,
    226         USB_KBD_LOCK_SCROLL
    227 };
     205//static const keycode_t usbhid_modifiers_keycodes[USB_HID_MOD_COUNT] = {
     206//      KC_LCTRL,         /* USB_HID_MOD_LCTRL */
     207//      KC_LSHIFT,        /* USB_HID_MOD_LSHIFT */
     208//      KC_LALT,          /* USB_HID_MOD_LALT */
     209//      0,                /* USB_HID_MOD_LGUI */
     210//      KC_RCTRL,         /* USB_HID_MOD_RCTRL */
     211//      KC_RSHIFT,        /* USB_HID_MOD_RSHIFT */
     212//      KC_RALT,          /* USB_HID_MOD_RALT */
     213//      0,                /* USB_HID_MOD_RGUI */
     214//};
     215
     216//typedef enum usbhid_lock_code {
     217//      USB_KBD_LOCK_NUM = 0x53,
     218//      USB_KBD_LOCK_CAPS = 0x39,
     219//      USB_KBD_LOCK_SCROLL = 0x47,
     220//      USB_KBD_LOCK_COUNT = 3
     221//} usbhid_lock_code;
     222
     223//static const usbhid_lock_code usbhid_lock_codes[USB_KBD_LOCK_COUNT] = {
     224//      USB_KBD_LOCK_NUM,
     225//      USB_KBD_LOCK_CAPS,
     226//      USB_KBD_LOCK_SCROLL
     227//};
    228228
    229229/*----------------------------------------------------------------------------*/
     
    709709                 *       two parts of the Report somehow.
    710710                 */
    711                 if( field->value != 0 ) {
     711                if (field->value != 0) {
    712712                        kbd_dev->keys[i] = field->usage;
    713713                }
     
    984984        }
    985985       
    986         // free the output buffer
    987         usb_hid_report_output_free((*kbd_dev)->output_buffer);
     986        // free all buffers
     987        if ((*kbd_dev)->keys != NULL) {
     988                free((*kbd_dev)->keys);
     989        }
     990        if ((*kbd_dev)->keys_old != NULL) {
     991                free((*kbd_dev)->keys_old);
     992        }
     993        if ((*kbd_dev)->led_data != NULL) {
     994                free((*kbd_dev)->led_data);
     995        }
     996        if ((*kbd_dev)->output_buffer != NULL) {
     997                free((*kbd_dev)->output_buffer);
     998        }
     999        if ((*kbd_dev)->led_path != NULL) {
     1000                usb_hid_report_path_free((*kbd_dev)->led_path);
     1001        }
     1002        if ((*kbd_dev)->output_buffer != NULL) {
     1003                usb_hid_report_output_free((*kbd_dev)->output_buffer);
     1004        }
    9881005
    9891006        free(*kbd_dev);
     
    10051022                } else {
    10061023                        usb_kbd_free(&kbd_dev);
     1024                        hid_dev->data = NULL;
    10071025                }
    10081026        }
Note: See TracChangeset for help on using the changeset viewer.