mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 06:39:39 +00:00
buttons 4 & 5
This commit is contained in:
parent
57574f3d3b
commit
59772324ff
1 changed files with 21 additions and 14 deletions
|
@ -43,24 +43,24 @@ static const unsigned char mouse_report_desc[] = {
|
||||||
|
|
||||||
// Usage Minimum (1)
|
// Usage Minimum (1)
|
||||||
0x19, 0x01,
|
0x19, 0x01,
|
||||||
// Usage Maximum (3)
|
// Usage Maximum (5)
|
||||||
0x29, 0x03,
|
0x29, 0x05,
|
||||||
// Logical Minimum (0)
|
// Logical Minimum (0)
|
||||||
0x15, 0x00,
|
0x15, 0x00,
|
||||||
// Logical Maximum (1)
|
// Logical Maximum (1)
|
||||||
0x25, 0x01,
|
0x25, 0x01,
|
||||||
// Report Count (3)
|
// Report Count (5)
|
||||||
0x95, 0x03,
|
0x95, 0x05,
|
||||||
// Report Size (1)
|
// Report Size (1)
|
||||||
0x75, 0x01,
|
0x75, 0x01,
|
||||||
// Input (Data, Variable, Absolute): 3 buttons bits
|
// Input (Data, Variable, Absolute): 5 buttons bits
|
||||||
0x81, 0x02,
|
0x81, 0x02,
|
||||||
|
|
||||||
// Report Count (1)
|
// Report Count (1)
|
||||||
0x95, 0x01,
|
0x95, 0x01,
|
||||||
// Report Size (5)
|
// Report Size (3)
|
||||||
0x75, 0x05,
|
0x75, 0x03,
|
||||||
// Input (Constant): 5 bits padding
|
// Input (Constant): 3 bits padding
|
||||||
0x81, 0x01,
|
0x81, 0x01,
|
||||||
|
|
||||||
// Usage Page (Generic Desktop)
|
// Usage Page (Generic Desktop)
|
||||||
|
@ -98,12 +98,14 @@ static const unsigned char mouse_report_desc[] = {
|
||||||
*
|
*
|
||||||
* 7 6 5 4 3 2 1 0
|
* 7 6 5 4 3 2 1 0
|
||||||
* +---------------+
|
* +---------------+
|
||||||
* byte 0: |0 0 0 0 0 . . .| buttons state
|
* byte 0: |0 0 0 . . . . .| buttons state
|
||||||
* +---------------+
|
* +---------------+
|
||||||
* ^ ^ ^
|
* ^ ^ ^ ^ ^
|
||||||
* | | `- left button
|
* | | | | `- left button
|
||||||
* | `--- right button
|
* | | | `--- right button
|
||||||
* `----- middle button
|
* | | `----- middle button
|
||||||
|
* | `------- button 4
|
||||||
|
* `--------- button 5
|
||||||
*
|
*
|
||||||
* +---------------+
|
* +---------------+
|
||||||
* byte 1: |. . . . . . . .| relative x motion
|
* byte 1: |. . . . . . . .| relative x motion
|
||||||
|
@ -152,7 +154,12 @@ buttons_state_to_hid_buttons(uint8_t buttons_state) {
|
||||||
if (buttons_state & SC_MOUSE_BUTTON_MIDDLE) {
|
if (buttons_state & SC_MOUSE_BUTTON_MIDDLE) {
|
||||||
c |= 1 << 2;
|
c |= 1 << 2;
|
||||||
}
|
}
|
||||||
// TODO buttons 4 and 5?
|
if (buttons_state & SC_MOUSE_BUTTON_X1) {
|
||||||
|
c |= 1 << 3;
|
||||||
|
}
|
||||||
|
if (buttons_state & SC_MOUSE_BUTTON_X2) {
|
||||||
|
c |= 1 << 4;
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue