askmrsinh / touchpad-indicator

Touchpad management GNOME Shell Extension.
https://extensions.gnome.org/extension/131/touchpad-indicator/
GNU General Public License v2.0
83 stars 20 forks source link

Trackpad not re-activating when using a touchscreen #40

Open mdugas opened 4 years ago

mdugas commented 4 years ago

My laptop has a built-in touch screen (Lenovo Yoga C930) and while connecting a mouse disabled the trackpad, disconnecting the mouse didn't reactivate the pad. According the the debug logs I posted on https://pastebin.com/eEgx5BtU the number of mouse detected when disconnecting my mouse is 2 (line 30) and when connecting it is 3 (line 6).

According to the following code block, one of the trigger for "no mouse" is the mouseCount being 0 and mouse present is mouseCount being different than 0. https://github.com/user501254/TouchpadIndicator/blob/783300252b6e04a9b694ceb17158796086616cf5/extension.js#L548-L560

I can't confirm if this also affects non-touchscreen devices or if other touchscreen devices have the same behavior.

I wonder if the following changes would be an appropriate solution for this:

1) add a button in the preferences to "calibrate" the extension by reading the mouseCount while no external mouse are connected and adding the value as a property to the extension.

2) get the code block to use that property instead of the hardcoded 0, plus change the mouse presence detection to be strictly greater than the property defined above / when mouse disconnected, the value being lower or equal than the property.

askmrsinh commented 4 years ago

Hi, thank you for reporting this and the pull request. Could you please also provide the N: Name= and P: Phys= lines corresponding to your touchscreen device in the output for cat /proc/bus/input/devices?

mdugas commented 4 years ago

This specific touchscreen has 2 entries: 1) Pen

lukeorland commented 4 years ago

I'm having the same issue with a Dell XPS 13 Developer Edition.

I: Bus=0003 Vendor=04f3 Product=20d0 Version=0110
N: Name="ELAN Touchscreen"
P: Phys=usb-0000:00:14.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:20D0.0001/input/input14
U: Uniq=
H: Handlers=mouse0 event5 
B: PROP=2
B: EV=1b
B: KEY=400 0 0 0 0 0
B: ABS=3273800000000003
B: MSC=20

I: Bus=0003 Vendor=04f3 Product=20d0 Version=0110
N: Name="ELAN Touchscreen UNKNOWN"
P: Phys=usb-0000:00:14.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:20D0.0001/input/input15
U: Uniq=
H: Handlers=event6 
B: PROP=0
B: EV=9
B: ABS=10000000000

I: Bus=0003 Vendor=04f3 Product=20d0 Version=0110
N: Name="ELAN Touchscreen UNKNOWN"
P: Phys=usb-0000:00:14.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04F3:20D0.0001/input/input16
U: Uniq=
H: Handlers=event7 
B: PROP=0
B: EV=100001
askmrsinh commented 4 years ago

Hi @mdugas @lukeorland,

Some laptops may have internal dummy/shadow mouse pointers which may be adding to the extra count of mouse devices currently plugged-in and thus hamper auto-enable/disable feature. For example on Dell XPS 9370:

[ashesh@localhost-live ~]$ xinput --list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ DELL07E6:00 06CB:76AF Mouse               id=13   [slave  pointer  (2)]
⎜   ↳ DELL07E6:00 06CB:76AF Touchpad            id=14   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=20   [slave  pointer  (2)]
⎜   ↳ Logitech Wireless Mouse                   id=15   [slave  pointer  (2)]
⎜   ↳ ELAN24F0:00 04F3:24F0                     id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Integrated_Webcam_HD: Integrate           id=10   [slave  keyboard (3)]
    ↳ Integrated_Webcam_HD: Integrate           id=11   [slave  keyboard (3)]
    ↳ Intel HID events                          id=16   [slave  keyboard (3)]
    ↳ Intel HID 5 button array                  id=17   [slave  keyboard (3)]
    ↳ Dell WMI hotkeys                          id=18   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=19   [slave  keyboard (3)]

In the above output DELL07E6:00 06CB:76AF Mouse id=13 [slave pointer (2)] is internal and can not be unplugged. This will interfere with the mouse count value.

In my opinion, a better approach would be to allow an ignore list of such devices. This functionality was present before the rewrite but I removed it to save time. However, I plan to re-implement it soon. Meanwhile can you please share a more complete output of cat /proc/bus/input/devices along with xinput --list?

lukeorland commented 4 years ago

The outputs for my Dell XPS 13 9360 are here: https://gist.github.com/lukeorland/e1659b9be008a700a341782c3c563f27

mdugas commented 4 years ago

Here are the outputs for a Lenovo Yoga C930: https://pastebin.com/w6qDmdqa https://pastebin.com/5RhUfRV3

askmrsinh commented 4 years ago

The outputs for my Dell XPS 13 9360 are here: https://gist.github.com/lukeorland/e1659b9be008a700a341782c3c563f27

On your setup, the extension recognizes the following devices and types:

0: {name: "DLL075B:01 06CB:76AF Mouse", phys: "i2c-DLL075B:01", type: "mouse"}
1: {name: "DLL075B:01 06CB:76AF Touchpad", phys: "i2c-DLL075B:01", type: "touchpad"}
2: {name: "ELAN Touchscreen", phys: "usb-0000:00:14.0-4/input0", type: "touchscreen"}
3: {name: "Logitech M325", phys: "usb-0000:00:14.0-2.2/input2:1", type: "mouse"}
4: {name: "MOSART Semi. 2.4G Keyboard Mouse", phys: "usb-0000:00:14.0-2.1/input1", type: "mouse"}

As per my understanding, DLL075B:01 06CB:76AF Mouse is a shadow device (for DLL075B:01 06CB:76AF Touchpad) and hence can not be unplugged. due to this the mouse count will never go to 0 (thus always keeping the touchpad disabled).

This will be fixed once I implement the ignore devices functionality some time in the coming weeks.

askmrsinh commented 4 years ago

Here are the outputs for a Lenovo Yoga C930: https://pastebin.com/w6qDmdqa https://pastebin.com/5RhUfRV3

The devices recognized are:

0: {name: "Wacom HID 5196 Pen", phys: "i2c-WCOM5196:00", type: "mouse"}
1: {name: "Wacom HID 5196 Finger", phys: "i2c-WCOM5196:00", type: "mouse"}
2: {name: "SYNA2B31:00 06CB:CD3E Mouse", phys: "i2c-SYNA2B31:00", type: "mouse"}
3: {name: "SYNA2B31:00 06CB:CD3E Touchpad", phys: "i2c-SYNA2B31:00", type: "touchpad"}

I think there are two issues here.

  1. First that the Wacom device are incorrectly tagged as 'mouse' (default type) when they are clearly not. For this, I need to consider adding 5196 pen & 5196 finger to current list of known device strings https://github.com/user501254/TouchpadIndicator/blob/c21bfc9299b2b26f57c23169fd9def66ff36a4f8/lib.js#L41-L42

  2. Second, the device SYNA2B31:00 06CB:CD3E Mouse is internal and should be ignored.

rugubara commented 3 years ago

Is there any progress/workaround with this? I'm struggling with my Thinkpad P52 with Wacom:

ноя 09 10:47:25 PF16W6Y2 gnome-shell[13468]: [touchpad-indicator@orangeshirt] 2020-11-09T07:47:25.109Z {"name":"Wacom Pen and multitouch sensor Finger","phys":"usb-0000:00:14.0-10/input0","type":"mouse>
ноя 09 10:47:25 PF16W6Y2 gnome-shell[13468]: [touchpad-indicator@orangeshirt] 2020-11-09T07:47:25.111Z {"name":"Wacom Pen and multitouch sensor Pen","phys":"usb-0000:00:14.0-10/input1","type":"mouse"}
ноя 09 10:47:25 PF16W6Y2 gnome-shell[13468]: [touchpad-indicator@orangeshirt] 2020-11-09T07:47:25.112Z {"name":"ETPS/2 Elantech TrackPoint","phys":"isa0060/serio1/input1","type":"trackpoint"}
ноя 09 10:47:25 PF16W6Y2 gnome-shell[13468]: [touchpad-indicator@orangeshirt] 2020-11-09T07:47:25.113Z {"name":"ETPS/2 Elantech Touchpad","phys":"isa0060/serio1/input0","type":"touchpad"}
ноя 09 10:47:25 PF16W6Y2 gnome-shell[13468]: [touchpad-indicator@orangeshirt] 2020-11-09T07:47:25.114Z {"name":"HP Bluetooth Mouse X4000b Mouse","phys":"30:24:32:97:a8:9b","type":"mouse"}

the touchpad never gets enabled automatically when my HP bluetooth mouse disconnects.