Commit f124513d authored by Adya's avatar Adya

Stylus buttons working (fixed a stupid mistake)

parent 16ea8a65
......@@ -5,8 +5,6 @@ This is a clone of the `drivers/input/touchscreen/goodix.c` file from the Linux
*(Note: the driver has only been tested on the Chuwi Surbook thus far, feel free to let me know if it works on other devices)*
*(Note: unfortunately, the stylus buttons have yet to be supported. I will push to that repository as soon as support is added)*
#### The initial problems
With the mainline driver, the input events generated by **a finger or a pen were not differentiated** which led to spurious events reported to the system.
......
......@@ -61,7 +61,7 @@ struct goodix_ts_data {
#define GOODIX_KEYDOWN_EVENT(byte) \
(byte & 0b01110000)
#define GOODIX_IS_STYLUS_BTN_DOWN(byte, btn) \
((byte & 0x40) || (byte & (0b1 << btn)))
((byte & 0x40) || (byte & (0x10 << btn)))
#define GOODIX_TOOL_FINGER 0
#define GOODIX_TOOL_PEN 1
......@@ -432,9 +432,16 @@ static void goodix_process_events(struct goodix_ts_data *ts)
/*
* Bit 4 of the first byte reports the status of the capacitive
* Windows/Home button.
* input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
* This has been commented out as it wrongly interprets stylus buttons
* as capacitive panel buttons being pressed.
*/
input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
/*
* Note: Stylus buttons' state is only reported when the tip of the pen
* is in contact with the touchscreen frame. I didn't notice this until
* now and find it quite weird. Is it supposed to work this way ?
*/
if (GOODIX_KEYDOWN_EVENT(report.keys) || GOODIX_KEYDOWN_EVENT(prev_keys)) {
input_report_key(ts->pen_dev, BTN_STYLUS,
GOODIX_IS_STYLUS_BTN_DOWN(report.keys, GOODIX_STYLUS_BTN1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment