-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fw16 emulate the touchpad if it is removed If win32 boots without a valid device attached. it will cause the device to be disabled forever. Emulate the touchpad when it is disconnected. Signed-off-by: Kieran Levin <ktl@frame.work> * lotus remove sleep in input module check speed up input module detection so we can shutdown faster on disconnect Signed-off-by: Kieran Levin <ktl@frame.work> * lint cleanup Signed-off-by: Kieran Levin <ktl@frame.work> --------- Signed-off-by: Kieran Levin <ktl@frame.work>
- Loading branch information
Showing
7 changed files
with
480 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
369 changes: 369 additions & 0 deletions
369
zephyr/program/lotus/include/lotus/touchpad_descriptor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,369 @@ | ||
/* | ||
* Copyright (c) 2023 Framework Computer | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#ifndef __CROS_EC_TOUCHPAD_DESCRIPTOR_H | ||
#define __CROS_EC_TOUCHPAD_DESCRIPTOR_H | ||
|
||
#include "hid_device.h" | ||
|
||
/* This exactly mimics the touchpad when it is not physically connected */ | ||
static const uint8_t touchpad_report_desc[] = { | ||
0x05, 0x01, /* USAGE_PAGE () */ | ||
0x09, 0x02, | ||
0xA1, 0x01, | ||
0x85, 0x01, | ||
0x05, 0x01, | ||
0x09, 0x01, | ||
0xA1, 0x00, | ||
0x05, 0x09, | ||
0x19, 0x01, | ||
0x29, 0x02, | ||
0x15, 0x00, | ||
0x25, 0x01, | ||
0x75, 0x01, | ||
0x95, 0x02, | ||
0x81, 0x02, | ||
0x95, 0x06, | ||
0x81, 0x03, | ||
0x05, 0x01, | ||
0x09, 0x30, | ||
0x09, 0x31, | ||
0x09, 0x38, | ||
0x15, 0x81, | ||
0x25, 0x7F, | ||
0x75, 0x08, | ||
0x95, 0x03, | ||
0x81, 0x26, | ||
0x05, 0x0C, | ||
0x0A, 0x38, | ||
0x02, 0x95, | ||
0x01, 0x81, | ||
0x06, 0x75, | ||
0x08, 0x95, | ||
0x03, 0x81, | ||
0x03, 0xC0, | ||
0xC0, 0x05, | ||
0x0D, 0x09, | ||
0x05, 0xA1, | ||
0x01, 0x85, | ||
0x04, 0x05, | ||
0x09, 0x09, | ||
0x01, 0x15, | ||
0x00, 0x25, | ||
0x01, 0x75, | ||
0x01, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x95, | ||
0x02, 0x81, | ||
0x03, 0x06, | ||
0x01, 0xFF, | ||
0x09, 0x01, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x05, 0x0D, | ||
0x09, 0x54, | ||
0x25, 0x05, | ||
0x75, 0x04, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x09, 0x56, | ||
0x55, 0x0C, | ||
0x66, 0x01, | ||
0x10, 0x47, | ||
0xFF, 0xFF, | ||
0x00, 0x00, | ||
0x27, 0xFF, | ||
0xFF, 0x00, | ||
0x00, 0x75, | ||
0x10, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x05, | ||
0x0D, 0x09, | ||
0x22, 0xA1, | ||
0x02, 0x09, | ||
0x47, 0x09, | ||
0x42, 0x15, | ||
0x00, 0x25, | ||
0x01, 0x75, | ||
0x01, 0x95, | ||
0x02, 0x81, | ||
0x02, 0x95, | ||
0x02, 0x81, | ||
0x03, 0x09, | ||
0x51, 0x25, | ||
0x0A, 0x75, | ||
0x04, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x05, | ||
0x01, 0x09, | ||
0x30, 0x35, | ||
0x00, 0x46, | ||
0xC4, 0x04, | ||
0x26, 0x01, | ||
0x0F, 0x55, | ||
0x0E, 0x65, | ||
0x11, 0x75, | ||
0x10, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x09, | ||
0x31, 0x46, | ||
0xF8, 0x02, | ||
0x26, 0x58, | ||
0x09, 0x81, | ||
0x02, 0xC0, | ||
0x05, 0x0D, | ||
0x09, 0x22, | ||
0xA1, 0x02, | ||
0x09, 0x47, | ||
0x09, 0x42, | ||
0x15, 0x00, | ||
0x25, 0x01, | ||
0x75, 0x01, | ||
0x95, 0x02, | ||
0x81, 0x02, | ||
0x95, 0x02, | ||
0x81, 0x03, | ||
0x09, 0x51, | ||
0x25, 0x0A, | ||
0x75, 0x04, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x05, 0x01, | ||
0x09, 0x30, | ||
0x35, 0x00, | ||
0x46, 0xC4, | ||
0x04, 0x26, | ||
0x01, 0x0F, | ||
0x55, 0x0E, | ||
0x65, 0x11, | ||
0x75, 0x10, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x09, 0x31, | ||
0x46, 0xF8, | ||
0x02, 0x26, | ||
0x58, 0x09, | ||
0x81, 0x02, | ||
0xC0, 0x05, | ||
0x0D, 0x09, | ||
0x22, 0xA1, | ||
0x02, 0x09, | ||
0x47, 0x09, | ||
0x42, 0x15, | ||
0x00, 0x25, | ||
0x01, 0x75, | ||
0x01, 0x95, | ||
0x02, 0x81, | ||
0x02, 0x95, | ||
0x02, 0x81, | ||
0x03, 0x09, | ||
0x51, 0x25, | ||
0x0A, 0x75, | ||
0x04, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x05, | ||
0x01, 0x09, | ||
0x30, 0x35, | ||
0x00, 0x46, | ||
0xC4, 0x04, | ||
0x26, 0x01, | ||
0x0F, 0x55, | ||
0x0E, 0x65, | ||
0x11, 0x75, | ||
0x10, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x09, | ||
0x31, 0x46, | ||
0xF8, 0x02, | ||
0x26, 0x58, | ||
0x09, 0x81, | ||
0x02, 0xC0, | ||
0x05, 0x0D, | ||
0x09, 0x22, | ||
0xA1, 0x02, | ||
0x09, 0x47, | ||
0x09, 0x42, | ||
0x15, 0x00, | ||
0x25, 0x01, | ||
0x75, 0x01, | ||
0x95, 0x02, | ||
0x81, 0x02, | ||
0x95, 0x02, | ||
0x81, 0x03, | ||
0x09, 0x51, | ||
0x25, 0x0A, | ||
0x75, 0x04, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x05, 0x01, | ||
0x09, 0x30, | ||
0x35, 0x00, | ||
0x46, 0xC4, | ||
0x04, 0x26, | ||
0x01, 0x0F, | ||
0x55, 0x0E, | ||
0x65, 0x11, | ||
0x75, 0x10, | ||
0x95, 0x01, | ||
0x81, 0x02, | ||
0x09, 0x31, | ||
0x46, 0xF8, | ||
0x02, 0x26, | ||
0x58, 0x09, | ||
0x81, 0x02, | ||
0xC0, 0x05, | ||
0x0D, 0x09, | ||
0x22, 0xA1, | ||
0x02, 0x09, | ||
0x47, 0x09, | ||
0x42, 0x15, | ||
0x00, 0x25, | ||
0x01, 0x75, | ||
0x01, 0x95, | ||
0x02, 0x81, | ||
0x02, 0x95, | ||
0x02, 0x81, | ||
0x03, 0x09, | ||
0x51, 0x25, | ||
0x0A, 0x75, | ||
0x04, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x05, | ||
0x01, 0x09, | ||
0x30, 0x35, | ||
0x00, 0x46, | ||
0xC4, 0x04, | ||
0x26, 0x01, | ||
0x0F, 0x55, | ||
0x0E, 0x65, | ||
0x11, 0x75, | ||
0x10, 0x95, | ||
0x01, 0x81, | ||
0x02, 0x09, | ||
0x31, 0x46, | ||
0xF8, 0x02, | ||
0x26, 0x58, | ||
0x09, 0x81, | ||
0x02, 0xC0, | ||
0x05, 0x0D, | ||
0x85, 0x02, | ||
0x09, 0x55, | ||
0x15, 0x00, | ||
0x25, 0x05, | ||
0x75, 0x08, | ||
0x95, 0x01, | ||
0xB1, 0x02, | ||
0x05, 0x0D, | ||
0x85, 0x06, | ||
0x09, 0x59, | ||
0x15, 0x00, | ||
0x25, 0x0F, | ||
0x75, 0x08, | ||
0x95, 0x01, | ||
0xB1, 0x02, | ||
0x05, 0x0D, | ||
0x85, 0x07, | ||
0x09, 0x60, | ||
0x15, 0x00, | ||
0x25, 0x01, | ||
0x75, 0x01, | ||
0x95, 0x01, | ||
0xB1, 0x02, | ||
0x95, 0x0F, | ||
0xB1, 0x03, | ||
0x06, 0x00, | ||
0xFF, 0x85, | ||
0x0B, 0x09, | ||
0xC5, 0x15, | ||
0x00, 0x26, | ||
0xFF, 0x00, | ||
0x75, 0x08, | ||
0x96, 0x00, | ||
0x01, 0xB1, | ||
0x02, 0xC0, | ||
0x05, 0x0D, | ||
0x09, 0x0E, | ||
0xA1, 0x01, | ||
0x05, 0x0D, | ||
0x09, 0x22, | ||
0xA1, 0x02, | ||
0x85, 0x03, | ||
0x09, 0x52, | ||
0x15, 0x00, | ||
0x25, 0x0A, | ||
0x75, 0x08, | ||
0x95, 0x01, | ||
0xB1, 0x02, | ||
0xC0, 0x05, | ||
0x0D, 0x09, | ||
0x22, 0xA1, | ||
0x00, 0x85, | ||
0x05, 0x09, | ||
0x57, 0x09, | ||
0x58, 0x15, | ||
0x00, 0x25, | ||
0x01, 0x75, | ||
0x01, 0x95, | ||
0x02, 0xB1, | ||
0x02, 0x95, | ||
0x06, 0xB1, | ||
0x03, 0xC0, | ||
0xC0, 0x06, | ||
0x00, 0xFF, | ||
0x09, 0x01, | ||
0xA1, 0x01, | ||
0x85, 0x42, | ||
0x09, 0x06, | ||
0x15, 0x00, | ||
0x26, 0xFF, | ||
0x00, 0x75, | ||
0x08, 0x95, | ||
0x03, 0xB1, | ||
0x02, 0x85, | ||
0x43, 0x09, | ||
0x06, 0x15, | ||
0x00, 0x26, | ||
0xFF, 0x00, | ||
0x75, 0x08, | ||
0x95, 0x03, | ||
0xB1, 0x02, | ||
0x06, 0x00, | ||
0xFF, 0x85, | ||
0x41, 0x09, | ||
0x05, 0x15, | ||
0x00, 0x26, | ||
0xFF, 0x00, | ||
0x75, 0x08, | ||
0x96, 0x00, | ||
0x01, 0xB1, | ||
0x02, | ||
0xC0 /* END_COLLECTION */ | ||
}; | ||
#define I2C_TOUCHPAD_HID_DESC_REGISTER 0x0020 | ||
#define I2C_TOUCHPAD_HID_REPORT_DESC_REGISTER 0x0021 | ||
#define I2C_TOUCHPAD_HID_INPUT_REPORT_REGISTER 0x0024 | ||
#define I2C_TOUCHPAD_HID_OUTPUT_REPORT_REGISTER 0x0025 | ||
#define I2C_TOUCHPAD_HID_COMMAND_REGISTER 0x0022 | ||
#define I2C_TOUCHPAD_HID_DATA_REGISTER 0x0023 | ||
static struct i2c_hid_descriptor touchpad_hid_desc = { | ||
.wHIDDescLength = I2C_HID_DESC_LENGTH, | ||
.bcdVersion = I2C_HID_BCD_VERSION, | ||
.wReportDescLength = sizeof(touchpad_report_desc), | ||
.wReportDescRegister = I2C_TOUCHPAD_HID_REPORT_DESC_REGISTER, | ||
.wInputRegister = I2C_TOUCHPAD_HID_INPUT_REPORT_REGISTER, | ||
/*Note if there are multiple reports wMaxInputLength has to be max*/ | ||
.wMaxInputLength = 0x1F, | ||
.wOutputRegister = I2C_TOUCHPAD_HID_OUTPUT_REPORT_REGISTER, | ||
.wMaxOutputLength = 0, | ||
.wCommandRegister = I2C_TOUCHPAD_HID_COMMAND_REGISTER, | ||
.wDataRegister = I2C_TOUCHPAD_HID_DATA_REGISTER, | ||
.wVendorID = 0x093A, | ||
.wProductID = 0x0274, | ||
.wVersionID = 0x0905, | ||
}; | ||
|
||
|
||
|
||
#endif /* __CROS_EC_TOUCHPAD_DESCRIPTOR_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.