1 | /*
|
---|
2 | * Copyright (c) 2011 Vojtech Horky
|
---|
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 usbvirthid
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | * Logitech wireless mouse-keyboard combo simulation (see issue 349).
|
---|
34 | */
|
---|
35 | #include "../virthid.h"
|
---|
36 | #include <errno.h>
|
---|
37 | #include <usb/debug.h>
|
---|
38 | #include <usb/hid/hid.h>
|
---|
39 | #include <usb/hid/usages/core.h>
|
---|
40 |
|
---|
41 | static uint8_t iface1_report_descriptor[] = {
|
---|
42 | 0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x85, 0x02, 0x09, 0x01,
|
---|
43 | 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x10, 0x15, 0x00,
|
---|
44 | 0x25, 0x01, 0x95, 0x10, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01,
|
---|
45 | 0x16, 0x01, 0xF8, 0x26, 0xFF, 0x07, 0x75, 0x0C, 0x95, 0x02,
|
---|
46 | 0x09, 0x30, 0x09, 0x31, 0x81, 0x06, 0x15, 0x81, 0x25, 0x7F,
|
---|
47 | 0x75, 0x08, 0x95, 0x01, 0x09, 0x38, 0x81, 0x06, 0x05, 0x0C,
|
---|
48 | 0x0A, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xC0, 0xC0, 0x05,
|
---|
49 | 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x03, 0x75, 0x10, 0x95,
|
---|
50 | 0x02, 0x15, 0x01, 0x26, 0x8C, 0x02, 0x19, 0x01, 0x2A, 0x8C,
|
---|
51 | 0x02, 0x81, 0x00, 0xC0, 0x05, 0x01, 0x09, 0x80, 0xA1, 0x01,
|
---|
52 | 0x85, 0x04, 0x75, 0x02, 0x95, 0x01, 0x15, 0x01, 0x25, 0x03,
|
---|
53 | 0x09, 0x82, 0x09, 0x81, 0x09, 0x83, 0x81, 0x60, 0x75, 0x06,
|
---|
54 | 0x81, 0x03, 0xC0, 0x06, 0xBC, 0xFF, 0x09, 0x88, 0xA1, 0x01,
|
---|
55 | 0x85, 0x08, 0x19, 0x01, 0x29, 0xFF, 0x15, 0x01, 0x26, 0xFF,
|
---|
56 | 0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 0x00, 0xC0
|
---|
57 | };
|
---|
58 | #define iface1_input_size 8
|
---|
59 | static uint8_t iface1_in_data[] = {
|
---|
60 | /*0, 0, 0, 0, 0, 0, 0, 0,
|
---|
61 | 0, 9, 0, 0, 0, 0, 0, 0,
|
---|
62 | 0, 0, 9, 0, 0, 0, 0, 0,
|
---|
63 | 0, 9, 9, 0, 0, 0, 0, 0,*/
|
---|
64 | 0, 0, 0, 0, 0, 0, 0, 0
|
---|
65 | };
|
---|
66 |
|
---|
67 | static vuhid_interface_life_t iface1_life = {
|
---|
68 | .data_in = iface1_in_data,
|
---|
69 | .data_in_count = sizeof(iface1_in_data)/iface1_input_size,
|
---|
70 | .data_in_pos_change_delay = 50,
|
---|
71 | .msg_born = "Mouse of Logitech Unifying Receiver comes to life...",
|
---|
72 | .msg_die = "Mouse of Logitech Unifying Receiver disconnected."
|
---|
73 | };
|
---|
74 |
|
---|
75 |
|
---|
76 | vuhid_interface_t vuhid_interface_logitech_wireless_1 = {
|
---|
77 | .id = "lw1",
|
---|
78 | .name = "Logitech Unifying Receiver, interface 1 (mouse)",
|
---|
79 | .usb_subclass = USB_HID_SUBCLASS_BOOT,
|
---|
80 | .usb_protocol = USB_HID_PROTOCOL_MOUSE,
|
---|
81 |
|
---|
82 | .report_descriptor = iface1_report_descriptor,
|
---|
83 | .report_descriptor_size = sizeof(iface1_report_descriptor),
|
---|
84 |
|
---|
85 | .in_data_size = iface1_input_size,
|
---|
86 | .on_data_in = interface_live_on_data_in,
|
---|
87 |
|
---|
88 | .out_data_size = 0,
|
---|
89 | .on_data_out = NULL,
|
---|
90 |
|
---|
91 | .live = interface_life_live,
|
---|
92 |
|
---|
93 | .interface_data = &iface1_life,
|
---|
94 | .vuhid_data = NULL
|
---|
95 | };
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * @}
|
---|
99 | */
|
---|