diff options
Diffstat (limited to 'led_support.patch')
-rw-r--r-- | led_support.patch | 216 |
1 files changed, 115 insertions, 101 deletions
diff --git a/led_support.patch b/led_support.patch index 321857127454..53d8652bb5c3 100644 --- a/led_support.patch +++ b/led_support.patch @@ -1,6 +1,6 @@ -diff -ur xf86-input-synaptics-1.7.6/include/synaptics-properties.h xf86-input-synaptics-1.7.6_new/include/synaptics-properties.h ---- xf86-input-synaptics-1.7.6/include/synaptics-properties.h 2014-05-01 08:18:12.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/include/synaptics-properties.h 2015-10-29 11:37:06.960956364 +0300 +diff -ur xf86-input-synaptics-1.9.0/include/synaptics-properties.h xf86-input-synaptics-1.9.0_new/include/synaptics-properties.h +--- xf86-input-synaptics-1.9.0/include/synaptics-properties.h 2015-11-25 09:28:43.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/include/synaptics-properties.h 2016-11-27 11:23:28.548462733 +0300 @@ -158,4 +158,13 @@ /* 32 Bit Integer, 2 values, horizontal hysteresis, vertical hysteresis */ #define SYNAPTICS_PROP_NOISE_CANCELLATION "Synaptics Noise Cancellation" @@ -15,9 +15,9 @@ diff -ur xf86-input-synaptics-1.7.6/include/synaptics-properties.h xf86-input-sy +#define SYNAPTICS_PROP_LED_DOUBLE_TAP "Synaptics LED Dobule Tap" + #endif /* _SYNAPTICS_PROPERTIES_H_ */ -diff -ur xf86-input-synaptics-1.7.6/man/synaptics.man xf86-input-synaptics-1.7.6_new/man/synaptics.man ---- xf86-input-synaptics-1.7.6/man/synaptics.man 2014-05-01 08:18:12.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/man/synaptics.man 2015-10-29 11:38:20.123434539 +0300 +diff -ur xf86-input-synaptics-1.9.0/man/synaptics.man xf86-input-synaptics-1.9.0_new/man/synaptics.man +--- xf86-input-synaptics-1.9.0/man/synaptics.man 2016-05-23 04:33:13.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/man/synaptics.man 2016-11-27 11:27:02.555635489 +0300 @@ -573,6 +573,19 @@ A "touch" event happens when the Z value goes above FingerHigh, and an "untouch" event happens when the Z value goes below FingerLow. @@ -38,7 +38,7 @@ diff -ur xf86-input-synaptics-1.7.6/man/synaptics.man xf86-input-synaptics-1.7.6 .LP The MaxDoubleTapTime parameter has the same function as the MaxTapTime parameter, but for the second, third, etc tap in a tap sequence. -@@ -919,6 +932,19 @@ +@@ -918,6 +931,19 @@ .BI "Synaptics Pad Resolution" 32 bit unsigned, 2 values (read-only), vertical, horizontal in units/millimeter. @@ -58,19 +58,34 @@ diff -ur xf86-input-synaptics-1.7.6/man/synaptics.man xf86-input-synaptics-1.7.6 .SH "NOTES" Configuration through .I InputClass -diff -ur xf86-input-synaptics-1.7.6/src/eventcomm.c xf86-input-synaptics-1.7.6_new/src/eventcomm.c ---- xf86-input-synaptics-1.7.6/src/eventcomm.c 2014-05-13 05:33:21.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/src/eventcomm.c 2015-10-29 11:48:24.683944284 +0300 -@@ -62,6 +62,8 @@ - #define LONG(x) ((x) / LONG_BITS) - #define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +diff -ur xf86-input-synaptics-1.9.0/src/eventcomm.c xf86-input-synaptics-1.9.0_new/src/eventcomm.c +--- xf86-input-synaptics-1.9.0/src/eventcomm.c 2016-09-30 10:09:32.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/src/eventcomm.c 2016-11-30 09:55:03.374887254 +0300 +@@ -70,6 +70,10 @@ + #define ABS_MT_MAX ABS_MT_TOOL_Y + #define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1) ++/* file created by synaptics-led ++ by this file we control LED on touchpad */ +#define SYNAPTICS_LED_SYS_FILE "/sys/class/leds/psmouse::synaptics/brightness" + /** * Protocol-specific data. */ -@@ -392,6 +394,37 @@ +@@ -375,8 +379,12 @@ + int vendor, product; + struct model_lookup_t *model_lookup; + ++ xf86IDrvMsg(NULL, X_INFO, ++ "led_debug: try detect: vendor and product\n"); + vendor = libevdev_get_id_vendor(evdev); + product = libevdev_get_id_product(evdev); ++ xf86IDrvMsg(NULL, X_INFO, ++ "led_debug: try detect: vendor and product - OK\n"); + + for (model_lookup = model_lookup_table; model_lookup->vendor; + model_lookup++) { +@@ -429,6 +437,47 @@ return 0; } @@ -79,12 +94,15 @@ diff -ur xf86-input-synaptics-1.7.6/src/eventcomm.c xf86-input-synaptics-1.7.6_n +{ + SynapticsPrivate *priv = (SynapticsPrivate *)pInfo->private; + -+ xf86IDrvMsg(pInfo, X_INFO, "led: checking for access to %s\n", SYNAPTICS_LED_SYS_FILE); ++ xf86IDrvMsg(pInfo, X_INFO, ++ "led_debug: checking for access to %s\n", ++ SYNAPTICS_LED_SYS_FILE); ++ + priv->synpara.has_led = !access(SYNAPTICS_LED_SYS_FILE, W_OK); + if (priv->synpara.has_led) -+ xf86IDrvMsg(pInfo, X_INFO, "led: access ok\n"); -+ else -+ xf86IDrvMsg(pInfo, X_INFO, "led: no access\n"); ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: access ok\n"); ++ else xf86IDrvMsg(pInfo, X_INFO, "led_debug: no access\n"); ++ +} + +static void EventUpdateLED(InputInfoPtr pInfo) @@ -93,42 +111,59 @@ diff -ur xf86-input-synaptics-1.7.6/src/eventcomm.c xf86-input-synaptics-1.7.6_n + + if (priv->synpara.has_led) { + char *val = priv->synpara.led_status ? "255" : "0"; ++ xf86IDrvMsg(pInfo, X_INFO, ++ "led_debug: try to open SYNAPTICS_LED_SYS_FILE\n"); + int fd = open(SYNAPTICS_LED_SYS_FILE, O_WRONLY); + int err; + -+ if (fd < 0) -+ return; ++ if (fd < 0) return; ++ ++ xf86IDrvMsg(pInfo, X_INFO, ++ "led_debug: file opened, try to write to it for update status\n"); + err = write(fd, val, strlen(val)); + close(fd); -+ if (err < 0) -+ xf86IDrvMsg(pInfo, X_WARNING, "can't write LED value %s\n", val); ++ ++ if (err < 0) xf86IDrvMsg(pInfo, X_WARNING, ++ "led_debug: can't write LED value %s\n", val); ++ xf86IDrvMsg(pInfo, X_INFO, ++ "led_debug: write successful, LED status updated\n"); + } +} + /* Query device for axis ranges */ static void event_query_axis_ranges(InputInfoPtr pInfo) -@@ -928,6 +961,9 @@ - event_query_model(pInfo->fd, &priv->model, &priv->id_vendor, +@@ -976,6 +1025,19 @@ + event_query_model(proto_data->evdev, &priv->model, &priv->id_vendor, &priv->id_product); ++ int rc; ++ struct libevdev *evdev_fd; ++ + event_query_led(pInfo); -+ event_query_model(pInfo->fd, &priv->model, &priv->id_vendor, &priv->id_product); ++ ++ rc = libevdev_new_from_fd(pInfo->fd, &evdev_fd); ++ if (rc >= 0) ++ { ++ event_query_model(evdev_fd, &priv->model, ++ &priv->id_vendor, &priv->id_product); ++ libevdev_free(evdev_fd); ++ } + xf86IDrvMsg(pInfo, X_PROBED, "Vendor %#hx Product %#hx\n", priv->id_vendor, priv->id_product); } -@@ -1007,5 +1043,6 @@ +@@ -1076,5 +1138,6 @@ EventQueryHardware, EventReadHwState, EventAutoDevProbe, - EventReadDevDimensions + EventReadDevDimensions, -+ EventUpdateLED, ++ EventUpdateLED }; -diff -ur xf86-input-synaptics-1.7.6/src/properties.c xf86-input-synaptics-1.7.6_new/src/properties.c ---- xf86-input-synaptics-1.7.6/src/properties.c 2014-05-01 08:18:12.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/src/properties.c 2015-10-29 11:40:12.047245599 +0300 +diff -ur xf86-input-synaptics-1.9.0/src/properties.c xf86-input-synaptics-1.9.0_new/src/properties.c +--- xf86-input-synaptics-1.9.0/src/properties.c 2015-11-25 09:28:43.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/src/properties.c 2016-11-29 14:38:50.604241727 +0300 @@ -95,6 +95,9 @@ Atom prop_noise_cancellation = 0; Atom prop_product_id = 0; @@ -139,19 +174,20 @@ diff -ur xf86-input-synaptics-1.7.6/src/properties.c xf86-input-synaptics-1.7.6_ static Atom InitTypedAtom(DeviceIntPtr dev, char *name, Atom type, int format, int nvalues, -@@ -381,6 +384,11 @@ +@@ -381,6 +384,12 @@ + prop_noise_cancellation = InitAtom(pInfo->dev, SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 2, values); - ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: init device properties\n"); + prop_led = InitAtom(pInfo->dev, SYNAPTICS_PROP_LED, 8, 1, ¶->has_led); + prop_led_status = InitAtom(pInfo->dev, SYNAPTICS_PROP_LED_STATUS, 8, 1, ¶->led_status); + + prop_led_double_tap = InitAtom(pInfo->dev, SYNAPTICS_PROP_LED_DOUBLE_TAP, 8, 1, ¶->led_double_tap); -+ ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: init device properties - OK\n"); + /* only init product_id property if we actually know them */ if (priv->id_vendor || priv->id_product) { - values[0] = priv->id_vendor; -@@ -814,6 +822,22 @@ +@@ -815,6 +824,26 @@ para->hyst_x = hyst[0]; para->hyst_y = hyst[1]; } @@ -159,6 +195,8 @@ diff -ur xf86-input-synaptics-1.7.6/src/properties.c xf86-input-synaptics-1.7.6_ + if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) + return BadMatch; + ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: try to set property: prop_led_status \n"); ++ + if (para->has_led) { + para->led_status = *(BOOL*)prop->data; + if (priv->proto_ops && priv->proto_ops->UpdateLED) @@ -169,12 +207,14 @@ diff -ur xf86-input-synaptics-1.7.6/src/properties.c xf86-input-synaptics-1.7.6_ + if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER) + return BadMatch; + ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: try to set property: prop_led_double_tap \n"); ++ + para->led_double_tap = *(CARD8*)prop->data; + } else if (property == prop_product_id || property == prop_device_node) return BadValue; /* read-only */ else { /* unknown property */ -@@ -829,3 +853,14 @@ +@@ -830,3 +859,14 @@ return Success; } @@ -189,9 +229,9 @@ diff -ur xf86-input-synaptics-1.7.6/src/properties.c xf86-input-synaptics-1.7.6_ + XIChangeDeviceProperty(dev, prop_off, XA_INTEGER, 8, + PropModeReplace, 1, &val, FALSE); +} -diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_new/src/synaptics.c ---- xf86-input-synaptics-1.7.6/src/synaptics.c 2014-05-13 05:33:21.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/src/synaptics.c 2015-10-29 11:46:05.609365594 +0300 +diff -ur xf86-input-synaptics-1.9.0/src/synaptics.c xf86-input-synaptics-1.9.0_new/src/synaptics.c +--- xf86-input-synaptics-1.9.0/src/synaptics.c 2016-09-30 10:09:32.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/src/synaptics.c 2016-11-29 14:44:34.799994652 +0300 @@ -143,6 +143,7 @@ void InitDeviceProperties(InputInfoPtr pInfo); int SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, @@ -200,28 +240,31 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n const static struct { const char *name; -@@ -771,7 +771,8 @@ - the touchpad diagonal */ +@@ -796,6 +797,9 @@ pars->maxDeltaMM = diag * 0.25; } -- -+ pars->led_double_tap = -+ xf86SetBoolOption(opts, "LEDDoubleTap", TRUE); + ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: set default params for: led_double_tap\n"); ++ pars->led_double_tap = xf86SetBoolOption(opts, "LEDDoubleTap", TRUE); ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: set default params for: led_double_tap - OK\n"); /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */ if (pars->top_edge > pars->bottom_edge) { -@@ -1004,6 +1007,10 @@ +@@ -1039,6 +1043,13 @@ xf86AddEnabledDevice(pInfo); dev->public.on = TRUE; + /* update LED */ + if (priv->proto_ops && priv->proto_ops->UpdateLED) ++ { ++ xf86IDrvMsg(pInfo, X_INFO, "led_debug: UpdateLED\n"); + priv->proto_ops->UpdateLED(pInfo); ++ } + return Success; - } -@@ -1346,14 +1353,83 @@ + error: +@@ -1364,13 +1375,81 @@ return !Success; } @@ -293,7 +336,6 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n + return 0; /* already processed; ignore this finger event */ +} + -+ /* * Convert from absolute X/Y coordinates to a coordinate system where * -1 corresponds to the left/upper edge and +1 corresponds to the @@ -301,39 +343,19 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n */ static void -relative_coords(SynapticsPrivate * priv, int x, int y, -- double *relX, double *relY) +relative_coords(SynapticsPrivate *priv, int x, int y, -+ double *relX, double *relY) + double *relX, double *relY) { int minX = priv->synpara.left_edge; - int maxX = priv->synpara.right_edge; -@@ -1363,12 +1439,11 @@ - double yCenter = (minY + maxY) / 2.0; - - if ((maxX - xCenter > 0) && (maxY - yCenter > 0)) { -- *relX = (x - xCenter) / (maxX - xCenter); -- *relY = (y - yCenter) / (maxY - yCenter); -- } -- else { -- *relX = 0; -- *relY = 0; -+ *relX = (x - xCenter) / (maxX - xCenter); -+ *relY = (y - yCenter) / (maxY - yCenter); -+ } else { -+ *relX = 0; -+ *relY = 0; - } - } - -@@ -1581,6 +1656,7 @@ +@@ -1599,6 +1678,7 @@ { InputInfoPtr pInfo = arg; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + SynapticsParameters *para = &priv->synpara; struct SynapticsHwState *hw = priv->local_hw_state; int delay; - int sigstate; -@@ -1591,6 +1667,13 @@ + #if !HAVE_THREADED_INPUT +@@ -1611,6 +1691,13 @@ SynapticsCopyHwState(hw, priv->hwState); SynapticsResetTouchHwState(hw, FALSE); delay = HandleState(pInfo, hw, hw->millis, TRUE); @@ -347,7 +369,7 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n priv->timer_time = now; priv->timer = TimerSet(priv->timer, 0, delay, timerFunc, pInfo); -@@ -2773,7 +2856,7 @@ +@@ -2791,7 +2878,7 @@ /* If this is a clickpad and the user clicks in a soft button area, press * the soft button instead. */ @@ -356,7 +378,7 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n /* hw->left is down, but no other buttons were already down */ if (!(priv->lastButtons & 7) && hw->left && !hw->right && !hw->middle) { /* If the finger down event is delayed, the x and y -@@ -3072,6 +3155,12 @@ +@@ -3027,6 +3114,12 @@ Bool using_cumulative_coords = FALSE; Bool ignore_motion; @@ -369,13 +391,13 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n /* We need both and x/y, the driver can't handle just one of the two * yet. But since it's possible to hit a phys button on non-clickpads * without ever getting motion data first, we must continue with 0/0 for -@@ -3143,6 +3232,15 @@ +@@ -3100,6 +3193,15 @@ finger = priv->finger_state; } + if (para->has_led && para->led_double_tap) { -+ if (inside_active_area) -+ finger = handle_toggle_led(pInfo, hw, finger); ++ if (inside_active_area) ++ finger = handle_toggle_led(pInfo, hw, finger); + if (para->touchpad_off == 1) { + priv->finger_state = finger; + return delay; @@ -385,24 +407,24 @@ diff -ur xf86-input-synaptics-1.7.6/src/synaptics.c xf86-input-synaptics-1.7.6_n /* tap and drag detection. Needs to be performed even if the finger is in * the dead area to reset the state. */ timeleft = HandleTapProcessing(priv, hw, now, finger, inside_active_area); -diff -ur xf86-input-synaptics-1.7.6/src/synapticsstr.h xf86-input-synaptics-1.7.6_new/src/synapticsstr.h ---- xf86-input-synaptics-1.7.6/src/synapticsstr.h 2014-05-01 08:18:12.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/src/synapticsstr.h 2015-10-29 11:47:04.671303525 +0300 -@@ -226,7 +226,9 @@ - int area_left_edge, area_right_edge, area_top_edge, area_bottom_edge; /* area coordinates absolute */ +diff -ur xf86-input-synaptics-1.9.0/src/synapticsstr.h xf86-input-synaptics-1.9.0_new/src/synapticsstr.h +--- xf86-input-synaptics-1.9.0/src/synapticsstr.h 2016-09-15 06:46:35.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/src/synapticsstr.h 2016-11-27 11:54:52.427037175 +0300 +@@ -230,6 +230,10 @@ int softbutton_areas[4][4]; /* soft button area coordinates, 0 => right, 1 => middle , 2 => secondary right, 3 => secondary middle button */ int hyst_x, hyst_y; /* x and y width of hysteresis box */ -- + + Bool has_led; /* has an embedded LED */ + Bool led_status; /* Current status of LED (1=on) */ + Bool led_double_tap; /* double-tap period in ms for touchpad LED control */ ++ int maxDeltaMM; /* maximum delta movement (vector length) in mm */ } SynapticsParameters; -@@ -310,6 +312,11 @@ - Bool has_width; /* device reports finger width */ +@@ -313,6 +317,11 @@ Bool has_scrollbuttons; /* device has physical scrollbuttons */ Bool has_semi_mt; /* device is only semi-multitouch capable */ + Bool has_mt_palm_detect; /* device reports per finger width and pressure */ + int prop_change_pending; + Bool led_touch_state; + Bool led_tapped; @@ -411,18 +433,10 @@ diff -ur xf86-input-synaptics-1.7.6/src/synapticsstr.h xf86-input-synaptics-1.7. enum TouchpadModel model; /* The detected model */ unsigned short id_vendor; /* vendor id */ -diff -ur xf86-input-synaptics-1.7.6/src/synproto.h xf86-input-synaptics-1.7.6_new/src/synproto.h ---- xf86-input-synaptics-1.7.6/src/synproto.h 2014-05-13 05:33:21.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/src/synproto.h 2015-10-29 11:34:03.864805494 +0300 -@@ -31,6 +31,7 @@ - #include "config.h" - #endif - -+#include <xorg-server.h> - #include <unistd.h> - #include <sys/ioctl.h> - #include <xf86Xinput.h> -@@ -103,6 +104,7 @@ +diff -ur xf86-input-synaptics-1.9.0/src/synproto.h xf86-input-synaptics-1.9.0_new/src/synproto.h +--- xf86-input-synaptics-1.9.0/src/synproto.h 2015-11-25 02:47:05.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/src/synproto.h 2016-11-27 12:05:43.550729920 +0300 +@@ -109,6 +109,7 @@ struct SynapticsHwState * hwRet); Bool (*AutoDevProbe) (InputInfoPtr pInfo, const char *device); void (*ReadDevDimensions) (InputInfoPtr pInfo); @@ -430,10 +444,10 @@ diff -ur xf86-input-synaptics-1.7.6/src/synproto.h xf86-input-synaptics-1.7.6_ne }; #ifdef BUILD_PS2COMM -diff -ur xf86-input-synaptics-1.7.6/tools/synclient.c xf86-input-synaptics-1.7.6_new/tools/synclient.c ---- xf86-input-synaptics-1.7.6/tools/synclient.c 2014-03-20 03:18:02.000000000 +0400 -+++ xf86-input-synaptics-1.7.6_new/tools/synclient.c 2015-10-29 11:47:25.371985080 +0300 -@@ -148,6 +148,8 @@ +diff -ur xf86-input-synaptics-1.9.0/tools/synclient.c xf86-input-synaptics-1.9.0_new/tools/synclient.c +--- xf86-input-synaptics-1.9.0/tools/synclient.c 2015-11-25 09:28:43.000000000 +0300 ++++ xf86-input-synaptics-1.9.0_new/tools/synclient.c 2016-11-27 12:00:50.690234718 +0300 +@@ -147,6 +147,8 @@ {"MiddleButtonAreaRight", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 5}, {"MiddleButtonAreaTop", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 6}, {"MiddleButtonAreaBottom", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 7}, |