linux-surface / linux-surface

Linux Kernel for Surface Devices
4.62k stars 201 forks source link

[SLS] Support for Surface Aggregator Module (Keyboard, Touchpad, Battery) #596

Closed qzed closed 2 years ago

qzed commented 2 years ago

Add support for Surface Aggregator Module (SAM) subsystem devices on the Surface Laptop Studio. This seems to be the usual straight-forward addition of IDs to the registry. SAM probes correctly and seems to be accessible, although there is a warning that DMA could not be requested.

Full diagnostics package: https://github.com/linux-surface/acpidumps/files/7316139/diagnostics.tar.gz

qzed commented 2 years ago

@ukasuviok Can you clone https://github.com/linux-surface/surface-aggregator-module and run the following commands (from inside the cloned repository)?

First run sudo modprobe surface_aggregator_cdev, then

sudo ./scripts/ssam/hid.py hid-get-descriptor 1 1    # should be keyboard
sudo ./scripts/ssam/hid.py hid-get-descriptor 2 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 3 1    # should be touchpad
sudo ./scripts/ssam/hid.py hid-get-descriptor 4 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 5 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 6 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 7 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 8 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 9 1

and post the outputs of those commands. This helps us identify which HID devices are connected and which devices we need to add to the registry. Finally run

sudo ./scripts/ssam/ctrl.py request 2 1 1 0 1
sudo ./scripts/ssam/ctrl.py request 2 1 1 1 1
sudo ./scripts/ssam/ctrl.py request 2 2 1 0 1
sudo ./scripts/ssam/ctrl.py request 2 2 1 1 1

and also post the output of that. This should help verify that the battery interface hasn't changed.

ukasuviok commented 2 years ago

I cloned the repository, but ssam/hid.py and ssam/ctrl.py don't exist. The only file in scripts directory is diagnostics.sh.

qzed commented 2 years ago

Ah, looks like you cloned the wrong repository. You have to clone this one: https://github.com/linux-surface/surface-aggregator-module

ukasuviok commented 2 years ago

All of the hid.py commands fail with the following error:

Traceback (most recent call last):
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 132, in <module>
    main()
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 124, in main
    dump_raw_data(dev.get_device_descriptor(entry))
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 47, in get_device_descriptor
    done, part = self._get_device_descriptor_part(entry, len(data), n)
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 57, in _get_device_descriptor_part
    resp = self.ctrl.request(rqst)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request
    return _request(self.fd, request)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request
    raise OSError(-raw.status, errno.errorcode.get(-raw.status))
TimeoutError: [Errno 110] ETIMEDOUT

Output of the ctrl.py commands below:

sudo ./scripts/ssam/ctrl.py request 2 1 1 0 1
1f 00 00 00
sudo ./scripts/ssam/ctrl.py request 2 1 1 1 1
1f 00 00 00
sudo ./scripts/ssam/ctrl.py request 2 2 1 0 1
Traceback (most recent call last):
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/ctrl.py", line 49, in <module>
    main()
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/ctrl.py", line 43, in main
    rsp = ctrl.request(rqst)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request
    return _request(self.fd, request)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request
    raise OSError(-raw.status, errno.errorcode.get(-raw.status))
TimeoutError: [Errno 110] ETIMEDOUT
sudo ./scripts/ssam/ctrl.py request 2 2 1 1 1
Traceback (most recent call last):
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/ctrl.py", line 49, in <module>
    main()
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/ctrl.py", line 43, in main
    rsp = ctrl.request(rqst)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request
    return _request(self.fd, request)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request
    raise OSError(-raw.status, errno.errorcode.get(-raw.status))
TimeoutError: [Errno 110] ETIMEDOUT
qzed commented 2 years ago

Okay, so the output for the hid commands is a bit troubling, so if I didn't screw up with the commands that suggests that there might be a new interface. Are you sure that all of them time out? Could you also try the following commands?

sudo ./scripts/ssam/hid.py hid-get-descriptor 0 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 0

For the battery commands, this indicates that the interface hasn't changed (the two timeouts there are expected).

qzed commented 2 years ago

Oh and if you press any keys on the keyboard or touch the touchpad, is there any output to the dmesg log?

ukasuviok commented 2 years ago
sudo ./scripts/ssam/hid.py hid-get-descriptor 0 1
Traceback (most recent call last):
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 132, in <module>
    main()
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 124, in main
    dump_raw_data(dev.get_device_descriptor(entry))
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 47, in get_device_descriptor
    done, part = self._get_device_descriptor_part(entry, len(data), n)
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 57, in _get_device_descriptor_part
    resp = self.ctrl.request(rqst)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request
    return _request(self.fd, request)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request
    raise OSError(-raw.status, errno.errorcode.get(-raw.status))
TimeoutError: [Errno 110] ETIMEDOUT
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 0
Traceback (most recent call last):
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 132, in <module>
    main()
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 124, in main
    dump_raw_data(dev.get_device_descriptor(entry))
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 47, in get_device_descriptor
    done, part = self._get_device_descriptor_part(entry, len(data), n)
  File "/home/ukas/surface-aggregator-module/./scripts/ssam/hid.py", line 57, in _get_device_descriptor_part
    resp = self.ctrl.request(rqst)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request
    return _request(self.fd, request)
  File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request
    raise OSError(-raw.status, errno.errorcode.get(-raw.status))
TimeoutError: [Errno 110] ETIMEDOUT
ukasuviok commented 2 years ago

Oh and if you press any keys on the keyboard or touch the touchpad, is there any output to the dmesg log?

A lot of these.

[ 1354.311656] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.318990] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.326773] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.334105] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.341225] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.348413] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.355567] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.362999] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.370666] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.377986] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.385310] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.392634] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.399526] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.407049] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.414253] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.421943] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.429331] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.436626] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
[ 1354.443214] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x03)
qzed commented 2 years ago

Ahh, there we go. Okay, so it looks like the tid changed from 0x02 to 0x01. Give me a sec and I'll update the script.

qzed commented 2 years ago

Done, can you update the repo (git pull) and then run (note the added 1):

sudo ./scripts/ssam/hid.py hid-get-descriptor 1 1 1    # should be keyboard
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 2 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 3 1    # should be touchpad
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 4 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 5 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 6 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 7 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 8 1
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 9 1
ukasuviok commented 2 years ago

Here you go.

sudo ./scripts/ssam/hid.py hid-get-descriptor 1 1 1
[5, 1, 9, 6, 161, 1, 133, 1, 21, 0, 37, 1, 117, 1, 149, 8, 5, 7, 25, 224, 41, 231, 129, 2, 117, 8, 149, 10, 25, 0, 41, 145, 38, 255, 0, 129, 0, 5, 12, 10, 192, 2, 161, 2, 26, 193, 2, 42, 198, 2, 149, 6, 177, 3, 192, 5, 8, 25, 1, 41, 3, 117, 1, 149, 3, 37, 1, 145, 2, 149, 5, 145, 1, 192, 5, 1, 9, 128, 161, 1, 133, 91, 21, 0, 37, 1, 117, 1, 149, 3, 9, 151, 9, 152, 9, 153, 129, 2, 149, 5, 129, 1, 192, 5, 12, 9, 1, 161, 1, 133, 3, 149, 1, 117, 16, 21, 0, 38, 255, 3, 25, 0, 42, 255, 3, 129, 0, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 2 1
[5, 1, 9, 6, 161, 1, 133, 92, 21, 0, 37, 1, 117, 1, 149, 8, 5, 7, 25, 224, 41, 231, 129, 2, 25, 109, 41, 111, 117, 1, 149, 3, 129, 2, 149, 5, 129, 3, 192, 6, 244, 255, 9, 10, 161, 1, 9, 11, 161, 2, 133, 20, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 130, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 13, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 14, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 117, 5, 149, 1, 129, 3, 9, 12, 21, 0, 37, 100, 117, 8, 149, 1, 129, 2, 192, 192, 6, 244, 255, 9, 1, 161, 1, 9, 7, 161, 2, 133, 84, 6, 15, 255, 9, 80, 21, 0, 38, 255, 0, 117, 8, 149, 4, 130, 2, 1, 6, 244, 255, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 130, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 117, 7, 149, 1, 129, 1, 192, 9, 5, 161, 2, 133, 85, 6, 15, 255, 9, 80, 21, 0, 38, 255, 0, 117, 8, 149, 4, 146, 2, 1, 6, 244, 255, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 146, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 145, 2, 117, 7, 149, 1, 145, 1, 9, 4, 21, 0, 38, 255, 0, 117, 8, 149, 8, 146, 2, 1, 192, 9, 6, 161, 2, 133, 86, 9, 3, 21, 0, 38, 255, 0, 117, 8, 149, 6, 178, 2, 1, 9, 9, 21, 0, 37, 1, 117, 1, 149, 1, 177, 2, 117, 7, 149, 1, 177, 1, 192, 9, 19, 161, 2, 133, 110, 6, 15, 255, 9, 80, 21, 0, 37, 255, 117, 8, 149, 4, 130, 2, 1, 6, 244, 255, 9, 2, 21, 0, 37, 255, 117, 8, 149, 6, 130, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 17, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 18, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 117, 5, 149, 1, 129, 1, 192, 9, 21, 161, 2, 133, 111, 6, 15, 255, 9, 80, 21, 0, 37, 255, 117, 8, 149, 4, 146, 2, 1, 6, 244, 255, 9, 2, 21, 0, 37, 255, 117, 8, 149, 6, 146, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 145, 2, 117, 7, 149, 1, 145, 1, 9, 20, 21, 0, 37, 255, 117, 8, 149, 16, 146, 2, 1, 192, 133, 115, 9, 33, 21, 0, 37, 255, 117, 8, 149, 2, 177, 2, 9, 22, 161, 2, 133, 112, 9, 16, 21, 0, 37, 1, 117, 1, 149, 1, 177, 2, 9, 34, 21, 0, 37, 1, 117, 1, 149, 1, 177, 2, 117, 6, 149, 1, 177, 1, 192, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 3 1
[5, 1, 9, 2, 161, 1, 133, 2, 9, 1, 161, 0, 5, 9, 25, 1, 41, 2, 21, 0, 37, 1, 117, 1, 149, 2, 129, 2, 149, 6, 129, 3, 5, 1, 9, 48, 9, 49, 21, 129, 37, 127, 117, 8, 149, 2, 129, 6, 192, 192, 5, 13, 9, 5, 161, 1, 133, 4, 5, 13, 9, 34, 161, 2, 21, 0, 37, 1, 9, 71, 9, 66, 149, 2, 117, 1, 129, 2, 149, 1, 117, 3, 37, 5, 9, 81, 129, 2, 117, 1, 149, 3, 129, 3, 5, 1, 21, 0, 38, 250, 8, 117, 16, 85, 14, 101, 17, 9, 48, 53, 0, 70, 148, 4, 149, 1, 129, 2, 70, 4, 3, 38, 252, 5, 9, 49, 129, 2, 85, 0, 101, 0, 5, 13, 53, 0, 70, 208, 7, 21, 0, 38, 208, 7, 117, 16, 149, 1, 102, 1, 1, 9, 48, 129, 2, 69, 0, 85, 0, 101, 0, 192, 5, 13, 9, 34, 161, 2, 21, 0, 37, 1, 9, 71, 9, 66, 149, 2, 117, 1, 129, 2, 149, 1, 117, 3, 37, 5, 9, 81, 129, 2, 117, 1, 149, 3, 129, 3, 5, 1, 21, 0, 38, 250, 8, 117, 16, 85, 14, 101, 17, 9, 48, 53, 0, 70, 148, 4, 149, 1, 129, 2, 70, 4, 3, 38, 252, 5, 9, 49, 129, 2, 85, 0, 101, 0, 5, 13, 53, 0, 70, 208, 7, 21, 0, 38, 208, 7, 117, 16, 149, 1, 102, 1, 1, 9, 48, 129, 2, 69, 0, 85, 0, 101, 0, 192, 5, 13, 9, 34, 161, 2, 21, 0, 37, 1, 9, 71, 9, 66, 149, 2, 117, 1, 129, 2, 149, 1, 117, 3, 37, 5, 9, 81, 129, 2, 117, 1, 149, 3, 129, 3, 5, 1, 21, 0, 38, 250, 8, 117, 16, 85, 14, 101, 17, 9, 48, 53, 0, 70, 148, 4, 149, 1, 129, 2, 70, 4, 3, 38, 252, 5, 9, 49, 129, 2, 85, 0, 101, 0, 5, 13, 53, 0, 70, 208, 7, 21, 0, 38, 208, 7, 117, 16, 149, 1, 102, 1, 1, 9, 48, 129, 2, 69, 0, 85, 0, 101, 0, 192, 5, 13, 9, 34, 161, 2, 21, 0, 37, 1, 9, 71, 9, 66, 149, 2, 117, 1, 129, 2, 149, 1, 117, 3, 37, 5, 9, 81, 129, 2, 117, 1, 149, 3, 129, 3, 5, 1, 21, 0, 38, 250, 8, 117, 16, 85, 14, 101, 17, 9, 48, 53, 0, 70, 148, 4, 149, 1, 129, 2, 70, 4, 3, 38, 252, 5, 9, 49, 129, 2, 85, 0, 101, 0, 5, 13, 53, 0, 70, 208, 7, 21, 0, 38, 208, 7, 117, 16, 149, 1, 102, 1, 1, 9, 48, 129, 2, 69, 0, 85, 0, 101, 0, 192, 5, 13, 9, 34, 161, 2, 21, 0, 37, 1, 9, 71, 9, 66, 149, 2, 117, 1, 129, 2, 149, 1, 117, 3, 37, 5, 9, 81, 129, 2, 117, 1, 149, 3, 129, 3, 5, 1, 21, 0, 38, 250, 8, 117, 16, 85, 14, 101, 17, 9, 48, 53, 0, 70, 148, 4, 149, 1, 129, 2, 70, 4, 3, 38, 252, 5, 9, 49, 129, 2, 85, 0, 101, 0, 5, 13, 53, 0, 70, 208, 7, 21, 0, 38, 208, 7, 117, 16, 149, 1, 102, 1, 1, 9, 48, 129, 2, 69, 0, 85, 0, 101, 0, 192, 5, 13, 85, 12, 102, 1, 16, 71, 255, 255, 0, 0, 39, 255, 255, 0, 0, 117, 16, 149, 1, 9, 86, 129, 2, 85, 0, 101, 0, 9, 84, 37, 127, 149, 1, 117, 8, 129, 2, 5, 9, 9, 1, 37, 1, 117, 1, 149, 1, 129, 2, 149, 7, 129, 3, 6, 1, 255, 9, 1, 21, 0, 38, 255, 0, 53, 0, 69, 0, 117, 8, 149, 1, 129, 2, 9, 2, 117, 8, 149, 1, 129, 2, 9, 3, 21, 0, 39, 255, 255, 0, 0, 117, 16, 149, 1, 129, 2, 5, 13, 133, 4, 9, 85, 9, 89, 117, 4, 149, 2, 37, 15, 177, 2, 133, 5, 6, 0, 255, 9, 198, 21, 0, 37, 8, 117, 8, 149, 1, 177, 2, 9, 199, 38, 255, 0, 117, 8, 149, 32, 177, 2, 5, 14, 9, 1, 161, 2, 133, 209, 9, 35, 21, 0, 37, 100, 117, 8, 149, 1, 177, 2, 192, 192, 5, 13, 9, 14, 161, 1, 133, 7, 9, 34, 161, 2, 9, 82, 21, 0, 37, 10, 117, 8, 149, 1, 177, 2, 192, 9, 34, 161, 0, 133, 8, 9, 87, 9, 88, 117, 1, 149, 2, 37, 1, 177, 2, 149, 6, 177, 3, 192, 192, 6, 7, 255, 9, 1, 161, 1, 133, 10, 9, 2, 38, 255, 0, 117, 8, 149, 20, 145, 2, 133, 9, 9, 3, 145, 2, 133, 10, 9, 4, 149, 63, 129, 2, 133, 9, 9, 5, 129, 2, 133, 9, 9, 6, 149, 1, 177, 2, 133, 11, 9, 7, 177, 2, 192, 6, 5, 255, 9, 4, 161, 1, 133, 14, 9, 49, 145, 2, 9, 49, 129, 3, 9, 48, 145, 2, 9, 48, 129, 2, 149, 57, 9, 50, 146, 2, 1, 9, 50, 130, 2, 1, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 4 1
[]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 5 1
[]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 6 1
[5, 32, 9, 1, 161, 1, 133, 137, 5, 32, 9, 65, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 255, 117, 32, 149, 1, 85, 0, 177, 2, 10, 209, 228, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 10, 209, 20, 177, 2, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 209, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 129, 2, 192, 133, 161, 5, 32, 9, 115, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 13, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 84, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 85, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 192, 133, 177, 5, 32, 9, 138, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 131, 20, 21, 0, 38, 160, 140, 117, 16, 149, 1, 85, 14, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 131, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 4, 101, 0, 85, 10, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 133, 180, 5, 32, 9, 118, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 86, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 87, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 10, 88, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 10, 89, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 192, 133, 165, 5, 32, 9, 124, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 84, 4, 129, 2, 10, 85, 4, 129, 2, 192, 133, 166, 5, 32, 9, 123, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 84, 4, 129, 2, 10, 85, 4, 129, 2, 192, 133, 178, 5, 32, 9, 131, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 113, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 118, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 15, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 133, 179, 5, 32, 9, 134, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 126, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 127, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 128, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 129, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 7 1
[6, 0, 255, 10, 0, 249, 161, 1, 133, 50, 117, 16, 149, 2, 21, 0, 39, 255, 255, 0, 0, 10, 1, 249, 10, 6, 249, 177, 2, 117, 32, 149, 1, 39, 255, 255, 255, 127, 10, 2, 249, 177, 2, 117, 8, 149, 8, 38, 255, 0, 10, 3, 249, 178, 2, 1, 149, 16, 10, 4, 249, 178, 2, 1, 10, 5, 249, 178, 2, 1, 117, 16, 149, 1, 39, 255, 255, 0, 0, 10, 6, 249, 129, 2, 117, 8, 149, 1, 133, 51, 21, 0, 38, 255, 0, 10, 7, 249, 177, 2, 38, 1, 0, 10, 8, 249, 177, 2, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 8 1
[5, 1, 9, 128, 161, 1, 133, 93, 21, 0, 37, 1, 117, 1, 149, 3, 9, 129, 9, 130, 9, 131, 129, 2, 149, 5, 129, 1, 192]
sudo ./scripts/ssam/hid.py hid-get-descriptor 1 9 1
[]
qzed commented 2 years ago

Thanks! There's a lot more than I expected. I'll translate that and if all goes well you can expect keyboard, touchpad and battery support in the next release.

ukasuviok commented 2 years ago

Thanks! I appreciate all of your help.

qzed commented 2 years ago

Okay, translated HID descriptors

qzed commented 2 years ago

Since there are quite many HID devices in comparison to other devices, can you try running sudo ./scripts/ssam/hid.py hid-get-descriptor 1 <iid> 1 with <iid> from 10 to 20 and see if there's any output there? Just to check that we aren't missing anything.

Also if you have a slim-pen can you try to remove and re-stash the pen? That should produce some unhandled event messages in the dmesg log. Can you check what the iid (last number) is for those? I assume this should be 0x02 based on the descriptors.

Lastly, I assume touching the touchscreen doesn't emit any unhandled event messages?

ukasuviok commented 2 years ago

Nothing for 10-20.

Here's the output from unstashing/stashing the slim pen 2. [ 4662.016873] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4662.016885] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4662.065855] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4662.115772] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4662.165158] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4662.214901] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.793512] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.793523] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.843250] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.892915] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.942594] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02) [ 4670.992179] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x02)

No unhandled even messages for the touchscreen.

qzed commented 2 years ago

Perfect, thanks!

qzed commented 2 years ago

Okay, https://github.com/linux-surface/kernel/commit/2452f61c9351c791e56ba5c187d26ad797530fed should add support for all of this. I'll start some new kernel builds next. It will probably take two hours or so until they are available.

ukasuviok commented 2 years ago

Will an apt-get upgrade catch this or will it need to be built manually?

qzed commented 2 years ago

It will once the repo gets updated. That generally happens once per day (midnight UTC), but can be triggered manually. I'll have to catch some sleep soon though and it seems like the Debian/Ubuntu kernel won't be ready by then (see status) so I won't be able to trigger a manual update. I'll try to trigger one as soon as I wake up.

If you want to get it sooner, you'll have to check the release page of this repo and manually download it.

ukasuviok commented 2 years ago

I can wait. Thanks again.

Steve Dixon

On Sat, Oct 9, 2021, 8:38 PM Maximilian Luz @.***> wrote:

It will once the repo gets updated. That generally happens once per day (midnight UTC), but can be triggered manually. I'll have to catch some sleep soon though and it seems like the Debian/Ubuntu kernel won't be ready by then (see status https://github.com/linux-surface/linux-surface/runs/3848741605?check_suite_focus=true) so I won't be able to trigger a manual update. I'll try to trigger one as soon as I wake up.

If you want to get it sooner, you'll have to check the release page of this repo and manually download it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/linux-surface/linux-surface/issues/596#issuecomment-939389351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLLSQX5TYXS4SLZ4LRUJW3UGDVABANCNFSM5FVVLEFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

qzed commented 2 years ago

New releases are now available (v5.14.10-3). Can you check if battery information is now available and the touchpad and keyboard work?

Can you also use the surface tool (from the surface-control package) to check if switching performance modes / platform profiles work via surface profile set <profile> where <profile> is one of the profiles listed in surface profile list. After that, surface profile get should return the profile you've just set (maybe do that a couple of times with different profiles to make sure).

qzed commented 2 years ago

Ah and there's another thing that we should check (forgot that yesterday): Since the target ID changed, it's possible that the command used for enabling/disabling events also changed. To do that run

./scripts/ssam/evreg.py reg-disable 0x15 0x00 0x03

This should disable the touchpad. If the touchpad didn't work before (e.g. due to old kernel), it should stop emitting any unhandled event messages in the dmesg log. Running

./scripts/ssam/evreg.py reg-enable 0x15 0x00 0x03

should enable it again (or bring back the unhandled event messages). Can you make sure that this is the case?

ukasuviok commented 2 years ago

The command gives a timeout error.

sudo ./scripts/ssam/evreg.py reg-disable 0x15 0x00 0x03 Traceback (most recent call last): File "/home/ukas/surface-aggregator-module/./scripts/ssam/evreg.py", line 79, in main() File "/home/ukas/surface-aggregator-module/./scripts/ssam/evreg.py", line 75, in main run_command(event_command(cmd_name, ev_tc, ev_seq, ev_iid)) File "/home/ukas/surface-aggregator-module/./scripts/ssam/evreg.py", line 42, in run_command data = ctrl.request(rqst) File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 350, in request return _request(self.fd, request) File "/home/ukas/surface-aggregator-module/scripts/ssam/libssam.py", line 258, in _request raise OSError(-raw.status, errno.errorcode.get(-raw.status)) TimeoutError: [Errno 110] ETIMEDOUT

On Sun, Oct 10, 2021 at 6:05 AM Maximilian Luz @.***> wrote:

Ah and there's another thing that we should check (forgot that yesterday): Since the target ID changed, it's possible that the command used for enabling/disabling events also changed. To do that run

./scripts/ssam/evreg.py reg-disable 0x15 0x00 0x03

This should disable the touchpad. If the touchpad didn't work before (e.g. due to old kernel), it should stop emitting any unhandled event messages in the dmesg log. Running

./scripts/ssam/evreg.py reg-enable 0x15 0x00 0x03

should enable it again. Can you make sure that this is the case?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/linux-surface/linux-surface/issues/596#issuecomment-939461921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLLSQR4S4BOAKP73FUKUL3UGFXQVANCNFSM5FVVLEFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

qzed commented 2 years ago

Yeah okay, so that has changed as well. Can you change these lines in the evreg.py script (https://github.com/linux-surface/surface-aggregator-module/blob/a33c002fa5fb7a1468f14148dd54da0624ac394d/scripts/ssam/evreg.py#L14-L15), specifically 'tid': 2 to 'tid': 1 and try again?

If that doesn't work, can you try both

./scripts/ssam/evreg.py kip-disable 0x15 0x00 0x03
./scripts/ssam/evreg.py sam-disable 0x15 0x00 0x03

and see if any of that works (especially disables the unhandled event messages for the touchpad/the touchpad itself)? If the kip command times out, can you try changing the tid for that from 2 to 1 as well (https://github.com/linux-surface/surface-aggregator-module/blob/a33c002fa5fb7a1468f14148dd54da0624ac394d/scripts/ssam/evreg.py#L12-L13)?

So likely with v5.10.14-3 keyboard and touchpad won't work due to the driver timing out on that command when loading. Battery stats and platform profile should work though.

ukasuviok commented 2 years ago

Changing the script returns 00 for reg-enable and reg-disable.

qzed commented 2 years ago

Okay, that looks good so far. Does it have any effect on the touchpad events?

ukasuviok commented 2 years ago

Okay, that looks good so far. Does it have any effect on the touchpad events?

I totally forgot to actually test it. Yes, when disabled it stops the unahndled events and when enabled they return.

qzed commented 2 years ago

Perfect, thanks! So now we should know everything. I'll ping you when a new kernel with those changes is ready.

qzed commented 2 years ago

Okay, pushed https://github.com/linux-surface/kernel/commit/6e237b8709f483b5527e6036dcd67cbb14f09d1a to address that. New kernels are building now.

qzed commented 2 years ago

@ukasuviok New kernels are available now (in the repos). Can you check if battery status, keyboard, touchpad, and platform profiles work with that?

ukasuviok commented 2 years ago

I have a battery indicator now that seems to be reporting the correct information. I'm also able to switch power modes with the surface command. Unfortunately, the keyboard and trackpad are still not working.

uname -a Linux ukas-lt11u 5.14.11-surface #1 SMP Sun Oct 10 15:05:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

qzed commented 2 years ago

Hmm okay, can you post a dmesg log and the output of ls -al /sys/bus/surface_aggregator/devices?

ukasuviok commented 2 years ago

dmesg.txt ls -al /sys/bus/surface_aggregator/devices total 0 drwxr-xr-x 2 root root 0 Oct 10 12:22 . drwxr-xr-x 4 root root 0 Oct 10 12:22 .. lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:02:01:01:00 -> ../../../devices/platform/MSHW0123:00/01:02:01:01:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:02:01:01:01 -> ../../../devices/platform/MSHW0123:00/01:02:01:01:01 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:03:01:00:01 -> ../../../devices/platform/MSHW0123:00/01:03:01:00:01 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:01:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:01:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:02:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:02:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:03:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:03:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:06:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:06:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:07:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:07:00 lrwxrwxrwx 1 root root 0 Oct 10 12:22 01:15:01:08:00 -> ../../../devices/platform/MSHW0123:00/01:15:01:08:00

qzed commented 2 years ago

Ahh I forgot to update the line matching the device to the driver... that still only has target ID 2, but should naturally load against 1 and 2. You could try binding the driver manually. I think that should work (not entirely sure though). To do that run:

sudo modprobe surface_hid
echo 01:15:01:01:00 | sudo tee /sys/bus/surface_aggregator/drivers/surface_hid/bind
echo 01:15:01:03:00 | sudo tee /sys/bus/surface_aggregator/drivers/surface_hid/bind

That should hopefully get the keyboard and touchpad working. It's possible that this doesn't work though due to the missing match line.

ukasuviok commented 2 years ago

echo 01:15:01:01:00 | sudo tee /sys/bus/surface_aggregator/drivers/surface_hid/bind 01:15:01:01:00 tee: /sys/bus/surface_aggregator/drivers/surface_hid/bind: No such device

echo 01:15:01:03:00 | sudo tee /sys/bus/surface_aggregator/drivers/surface_hid/bind 01:15:01:03:00 tee: /sys/bus/surface_aggregator/drivers/surface_hid/bind: No such device

Also, I currently have he power profile set to low-power, but the laptop is still pretty warm and the fans are running.

qzed commented 2 years ago
echo 01:15:01:01:00 | sudo tee /sys/bus/surface_aggregator/drivers/surface_hid/bind
01:15:01:01:00
tee: /sys/bus/surface_aggregator/drivers/surface_hid/bind: No such device

Ah yeah okay then the match line blocks this. Anyway, I've triggered a new build. So hopefully this time it works.

Also, I currently have he power profile set to low-power, but the laptop is still pretty warm and the fans are running.

As far as I can tell, that profile mostly influences the cooling behavior (i.e. fan curve). You could try to figure out if there's something consuming a lot of CPU. If you've got a model with the discrete GPU you probably want to make sure that runtime PM is on for that (on my SB2 that also got decently warm just by idling) and that it's not used to render the desktop. You can check temperatures of the dGPU via nvidia-smi (if you've got the nvidia driver installed). There's some info on runtime PM here: https://github.com/linux-surface/surface-hotplug/wiki/Runtime-Power-Management.

qzed commented 2 years ago

Something else to check: Are there any unhandled event messages when you move the screen into different positions (e.g. switch between tablet mode and laptop mode)? If so, can you post those? Linux supports a SW_TABLET_MODE input event, would be good if we can add support for that as well (that allows e.g. Gnome to decide when to display the onscreen keyboard).

ukasuviok commented 2 years ago

Yes it does.

Tent/Tablet mode [ 228.686478] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 228.785235] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 228.885277] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 228.985273] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 229.085281] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 229.184025] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 229.283585] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 229.382200] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 229.482278] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01)

Back to Laptop mode [ 305.701958] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 305.800953] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 305.901276] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.000738] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.099793] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.199890] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.298957] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.397607] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01) [ 306.496649] surface_serial_hub serial0-0: event: unhandled event (rqid: 0x15, tc: 0x15, tid: 0x01, cid: 0x00, iid: 0x01)

Also thanks for the dGPU info. I disabled it and can already feel a difference heat wise and see a difference in the battery monitor.

qzed commented 2 years ago

Yes it does.

Okay, that looks like normal HID events from the keyboard device. Could be that that that's implemented that way. Might be worth to check the specific events being reported via evtest or hid-recorder something like that once the HID devices work.

Also thanks for the dGPU info. I disabled it and can already feel a difference heat wise and see a difference in the battery monitor.

Nice! Yeah the dGPU is a bit of a power hog. Best to keep that disabled until you actually need it or configure it so that it can go into low power mode (the last couple of driver updates from nvidia seem to have improved things, especially with NVreg_DynamicPowerManagement=0x02).

qzed commented 2 years ago

@ukasuviok Alright, new release is out. Can you test that?

qzed commented 2 years ago

Oh and if the keyboard should work this time, can you make sure that it still works after switching to tablet mode and back?

ukasuviok commented 2 years ago

Getting closer. The keyboard works but the trackpad does not.

The keyboard does work when flipping back and forth between tablet mode and laptop mode.

qzed commented 2 years ago

Okay, can you post a dmesg log?

ukasuviok commented 2 years ago

dmesg.txt Attached.

qzed commented 2 years ago

Are there any unhandled event messages when using the touchpad? As far as I can tell from the log, the HID device gets created just fine:

[    1.913427] input: Microsoft Surface 045E:09AF Mouse as /devices/platform/MSHW0123:00/01:15:01:03:00/0019:045E:09AF.0005/input/input15
[    1.913469] input: Microsoft Surface 045E:09AF Touchpad as /devices/platform/MSHW0123:00/01:15:01:03:00/0019:045E:09AF.0005/input/input16
[    1.913499] input: Microsoft Surface 045E:09AF UNKNOWN as /devices/platform/MSHW0123:00/01:15:01:03:00/0019:045E:09AF.0005/input/input17
[    1.913519] input: Microsoft Surface 045E:09AF UNKNOWN as /devices/platform/MSHW0123:00/01:15:01:03:00/0019:045E:09AF.0005/input/input18
[    1.913540] hid-multitouch 0019:045E:09AF.0005: input,hidraw4: <UNKNOWN> HID v1.11 Mouse [Microsoft Surface 045E:09AF] on 01:15:01:03:00
ukasuviok commented 2 years ago

There are no unhandled events. I did notice that the trackpad does work for clicks, but there's nothing for any sort of movement.

qzed commented 2 years ago

I wonder if that has something to do with their new haptic touchpad... from what I can tell it should receive HID events, but it's possible that either the kernel doesn't know what to do with them or needs to send some sort of enable-command back to the device (that's e.g. necessary for normal MS precision touchpads, which work in single-finger mouse-mode only until then).

Can you try and play around with hid-recorder and evtest a bit and see what they return as events. You might need to find the correct device first as it creates 4 HID sub-devices (Mouse, Touchpad, and 2 unknowns).

ukasuviok commented 2 years ago

I'm not sure how to use either. Both of them are installed, hid-recorder is unable to start with the following error.

sudo hid-recorder Traceback (most recent call last): File "/usr/local/bin/hid-recorder", line 8, in sys.exit(main()) File "/usr/lib/python3/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/hidtools/cli/record.py", line 75, in main device_list = [open(list_devices())] File "/usr/local/lib/python3.9/dist-packages/hidtools/cli/record.py", line 36, in list_devices d = HidrawDevice(f) File "/usr/local/lib/python3.9/dist-packages/hidtools/hidraw.py", line 227, in init self.bustype = BusType(bustype) File "/usr/lib/python3.9/enum.py", line 360, in call return cls.new(cls, value) File "/usr/lib/python3.9/enum.py", line 678, in new raise ve_exc ValueError: 25 is not a valid BusType

I'm assuming I need to specify a device to record, but I don't know which device that is.

qzed commented 2 years ago

Usage of both is sudo hid-recorder / sudo evtest and then select the respective device. That error is very odd.

Can you try cloning https://gitlab.freedesktop.org/bentiss/hid-tools and inside that repo run sudo ./hid-recorder. If you get any error messages similar to "could not import ..." you might need to install some additional python packages.