source: mainline/uspace/drv/usbhid/lgtch-ultrax/lgtch-ultrax.h@ e67399e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since e67399e was b20de1d, checked in by Lubos Slovak <lubos.slovak@…>, 15 years ago

Subdriver for Logitech UltraX keyboard improved.

  • Added mapping from usages to HelenOS keycodes - now lists only the Usages used by this keyboard + some other which are result of bad parsing of the report (will be removed, now only for demonstration purposes).
  • Added lgtch_init() and lgtch_deinit() functions (also to the subdriver mapping).
  • Some code of key handling is copied from boot kbd subdriver.
  • The subdriver creates its own DDF function and adds it into the 'keyboard' class, so that the console connects to it.
  • Fixed iterating over report.
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2011 Lubos Slovak
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup drvusbhid
30 * @{
31 */
32/** @file
33 * USB Logitech UltraX Keyboard sample driver.
34 */
35
36#ifndef USB_HID_LGTCH_ULTRAX_H_
37#define USB_HID_LGTCH_ULTRAX_H_
38
39#include <usb/devdrv.h>
40
41struct usb_hid_dev;
42
43/*----------------------------------------------------------------------------*/
44/**
45 * USB/HID keyboard device type.
46 *
47 * Holds a reference to generic USB/HID device structure and keyboard-specific
48 * data, such as currently pressed keys, modifiers and lock keys.
49 *
50 * Also holds a IPC phone to the console (since there is now no other way to
51 * communicate with it).
52 *
53 * @note Storing active lock keys in this structure results in their setting
54 * being device-specific.
55 */
56typedef struct usb_lgtch_ultrax_t {
57 /** Previously pressed keys (not translated to key codes). */
58 int32_t *keys_old;
59 /** Currently pressed keys (not translated to key codes). */
60 int32_t *keys;
61 /** Count of stored keys (i.e. number of keys in the report). */
62 size_t key_count;
63
64 /** IPC phone to the console device (for sending key events). */
65 int console_phone;
66
67 /** Information for auto-repeat of keys. */
68// usb_kbd_repeat_t repeat;
69
70 /** Mutex for accessing the information about auto-repeat. */
71// fibril_mutex_t *repeat_mtx;
72
73 /** State of the structure (for checking before use).
74 *
75 * 0 - not initialized
76 * 1 - initialized
77 * -1 - ready for destroying
78 */
79 int initialized;
80} usb_lgtch_ultrax_t;
81
82/*----------------------------------------------------------------------------*/
83
84int usb_lgtch_init(struct usb_hid_dev *hid_dev);
85
86void usb_lgtch_deinit(struct usb_hid_dev *hid_dev);
87
88bool usb_lgtch_polling_callback(struct usb_hid_dev *hid_dev, uint8_t *buffer,
89 size_t buffer_size);
90
91/*----------------------------------------------------------------------------*/
92
93#endif // USB_HID_LGTCH_ULTRAX_H_
94
95/**
96 * @}
97 */
Note: See TracBrowser for help on using the repository browser.