Yanndroid / SiriRemote-Linux

Control your Linux machine with an Apple TV 4th Siri Remote
23 stars 2 forks source link

Question: Will this work with newer Apple TV remotes? #1

Open Stuckya opened 1 year ago

Stuckya commented 1 year ago

First, Awesome project!

Second, Will this library work with the Siri Remote 3rd generation? https://support.apple.com/en-us/HT205329

Yanndroid commented 1 year ago

There's a high chance that some of the buttons will work, because the remote model and tv model are interchangeable. Just try it I guess. If it doesn't work at all or partially, there's still hope.

Stuckya commented 1 year ago

Great to know!

With the Harmony Elite discontinued, I've been thinking about using an Apple TV remote as a Universal Remote connected to a Raspberry Pi as the hub.

Stuckya commented 1 year ago

Feel free to close this issue. Thanks for the quick response!

Yanndroid commented 1 year ago

I'm actually interested if it works or not. Would be nice to support more models.

Yanndroid commented 1 year ago

@Stuckya any news on this? Have you tried it?

superpupervlad commented 10 months ago

@Yanndroid I tried it with Siri Remote 3 gen and it fails at writing magic byte:

Traceback (most recent call last):
  File "/home/vlad/Temp/SiriRemote-Linux/./main.py", line 80, in <module>
    SiriRemote(mac, Callback())
  File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 46, in __init__
    self.__setup()
  File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 61, in __setup
    self.__device.write_characteristic(0x001d, b'\x01')  # "magic" byte
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vlad/Temp/SiriRemote-Linux/remote/bt.py", line 26, in write_characteristic
    self.__peripheral.writeCharacteristic(handle, value, True)
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 543, in writeCharacteristic
    return self._getResp('wr')
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 368, in _waitResp
    raise BTLEGattError("Bluetooth command failed", resp)
bluepy.btle.BTLEGattError: Bluetooth command failed (code: 3, error: Attribute can't be written)

I don't have 2 gen to check if it's 3 gen specific or not. But I capture connection of 3 gen to Macbook with working RemoteBuddy 2 using PacketLogger, hope this will help. (MAC of Siri Remote is 10:B9:C4:1D:44:59) BL.zip

Yanndroid commented 10 months ago

@superpupervlad

Hi there, Thanks for also providing bluetooth logs from MacOS, they were indeed very useful. I made a second branch with some adjustments for your remote. Would be nice if you can try it out. (It also contains more stuff for logging)

superpupervlad commented 9 months ago

@Yanndroid Here is the output from new branch:

Output ``` Service 00001800-0000-1000-8000-00805f9b34fb Characteristic 00002a00-0000-1000-8000-00805f9b34fb 0x2 0x3 Characteristic 00002a01-0000-1000-8000-00805f9b34fb 0x4 0x5 Characteristic 00002a04-0000-1000-8000-00805f9b34fb 0x6 0x7 Characteristic 00002aa6-0000-1000-8000-00805f9b34fb 0x8 0x9 Service 00001801-0000-1000-8000-00805f9b34fb Service 0000180a-0000-1000-8000-00805f9b34fb Characteristic 00002a29-0000-1000-8000-00805f9b34fb 0xc 0xd Characteristic 00002a24-0000-1000-8000-00805f9b34fb 0xe 0xf Characteristic 00002a25-0000-1000-8000-00805f9b34fb 0x10 0x11 Characteristic 00002a27-0000-1000-8000-00805f9b34fb 0x12 0x13 Characteristic 00002a26-0000-1000-8000-00805f9b34fb 0x14 0x15 Characteristic 00002a50-0000-1000-8000-00805f9b34fb 0x16 0x17 Service 8341f2b4-c013-4f04-8197-c4cdb42e26dc Characteristic <0188bf66-463a-405d-91fd-0b8940b92254> 0188bf66-463a-405d-91fd-0b8940b92254 0x19 0x1a Characteristic <0188bf67-463a-405d-91fd-0b8940b92254> 0188bf67-463a-405d-91fd-0b8940b92254 0x1b 0x1c Characteristic <0188bf68-463a-405d-91fd-0b8940b92254> 0188bf68-463a-405d-91fd-0b8940b92254 0x1d 0x1e Characteristic <2bdcaebe-8746-45df-a841-96b840980fb7> 2bdcaebe-8746-45df-a841-96b840980fb7 0x1f 0x20 Characteristic <2bdcaebe-8746-45df-a841-96b840980fb8> 2bdcaebe-8746-45df-a841-96b840980fb8 0x21 0x22 Characteristic <30e69638-3752-4feb-a3aa-3226bcd05ace> 30e69638-3752-4feb-a3aa-3226bcd05ace 0x23 0x24 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x25 Service 0000181e-0000-1000-8000-00805f9b34fb Characteristic 00002aa5-0000-1000-8000-00805f9b34fb 0x27 0x28 Characteristic 00002aa4-0000-1000-8000-00805f9b34fb 0x29 0x2a Descriptor 00002900-0000-1000-8000-00805f9b34fb 0x2b Service 0000180f-0000-1000-8000-00805f9b34fb Characteristic 00002a19-0000-1000-8000-00805f9b34fb 0x2d 0x2e Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x2f Characteristic <2a1a> 00002a1a-0000-1000-8000-00805f9b34fb 0x30 0x31 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x32 Service 00001812-0000-1000-8000-00805f9b34fb Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x34 0x35 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x36 Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x37 Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x38 0x39 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x3a Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x3b Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x3c 0x3d Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x3e Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x3f Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x40 0x41 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x42 Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x43 Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x44 0x45 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x46 Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x47 Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x48 0x49 Descriptor 00002902-0000-1000-8000-00805f9b34fb 0x4a Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x4b Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x4c 0x4d Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x4e Characteristic 00002a4d-0000-1000-8000-00805f9b34fb 0x4f 0x50 Descriptor 00002908-0000-1000-8000-00805f9b34fb 0x51 Characteristic 00002a4b-0000-1000-8000-00805f9b34fb 0x52 0x53 Characteristic 00002a4a-0000-1000-8000-00805f9b34fb 0x54 0x55 Characteristic 00002a4c-0000-1000-8000-00805f9b34fb 0x56 0x57 Traceback (most recent call last): File "/home/vlad/Temp/SiriRemote-Linux/./main.py", line 80, in SiriRemote(mac, Callback()) File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 45, in __init__ self.__setup() File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 49, in __setup self.__device.connect() File "/home/vlad/Temp/SiriRemote-Linux/remote/bt.py", line 20, in connect for desc in ch.getDescriptors(): ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 208, in getDescriptors for desc in self.peripheral.getDescriptors(self.valHandle+1, hndEnd): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 524, in getDescriptors resp = self._getResp('desc') ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 368, in _waitResp raise BTLEGattError("Bluetooth command failed", resp) bluepy.btle.BTLEGattError: Bluetooth command failed (code: 10, error: No attribute found within the given range) ```

If I wrap for desc in ch.getDescriptors(): line into try-except construction the code will end successfully. <HID Control Point> is the last characteristic in the last service

Yanndroid commented 9 months ago

@superpupervlad Thanks, you can remove the logging part now (bt.py L.15-L.21).

Doesn't it print anything when you press buttons after that? The battery percentage should also be printed at the beginning (at least mine sends it).

You can try commenting out one or more of the lines in remote.py (L.54-59). Or all of them and see if the battery is printed when you plug or unplug the remote. I don't know why your version has so many Report Characteristics in Human Interface Device.

Mine only has those for HID:

Service <uuid=Human Interface Device handleStart=21 handleEnd=37> 00001812-0000-1000-8000-00805f9b34fb
  Characteristic <HID Information> 00002a4a-0000-1000-8000-00805f9b34fb 0x16 0x17
  Characteristic <Report Map> 00002a4b-0000-1000-8000-00805f9b34fb 0x18 0x19
  Characteristic <HID Control Point> 00002a4c-0000-1000-8000-00805f9b34fb 0x1a 0x1b
  Characteristic <Report> 00002a4d-0000-1000-8000-00805f9b34fb 0x1c 0x1d
    Descriptor <Report Reference> 00002908-0000-1000-8000-00805f9b34fb 0x1e
  Characteristic <Report> 00002a4d-0000-1000-8000-00805f9b34fb 0x1f 0x20
    Descriptor <Report Reference> 00002908-0000-1000-8000-00805f9b34fb 0x21
  Characteristic <Report> 00002a4d-0000-1000-8000-00805f9b34fb 0x22 0x23
    Descriptor <Client Characteristic Configuration> 00002902-0000-1000-8000-00805f9b34fb 0x24
    Descriptor <Report Reference> 00002908-0000-1000-8000-00805f9b34fb 0x25

Something else might be the MTU. I doubt it, but try setting it to 247 instead (remote.py L.50).

superpupervlad commented 9 months ago

@Yanndroid The problem was on my side. My bt agent works in NoInputNoOutput mode and when linux tries to pair with remote it fails and all enable_notifications doesn't work. So I execute bt-agent -c DisplayYesNo and then pair it and it started to work.

Interesting thing that without 19-20 lines in new bt.py it will not print any output.

It seems that new gen has new button map: image e.g. 1000 means that after I press power button program prints 0x39 1000. After release button it always prints 0x39 0000.

Output when it connects to charging:

0x2e 42
0x31 ab
0x2e 42
0x31 bb

When it disconnects:

0x2e 42
0x31 af

Changing MTU to 247 has no effect.

After I fix pairing issues I was able to connect to remote without holding Back and Volume up. It connects immediately after I press any button. But now I have other minor issue: if I stop the program and then quickly start it again it connects to remote and after printing all characteristics if crashes:

Traceback (most recent call last):
  File "/home/vlad/Temp/SiriRemote-Linux/./main.py", line 80, in <module>
    SiriRemote(mac, Callback())
  File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 45, in __init__
    self.__setup()
  File "/home/vlad/Temp/SiriRemote-Linux/remote/remote.py", line 50, in __setup
    self.__device.set_mtu(104)
  File "/home/vlad/Temp/SiriRemote-Linux/remote/bt.py", line 41, in set_mtu
    self.__peripheral.setMTU(value)
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 557, in setMTU
    return self._getResp('stat')
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/bluepy/btle.py", line 368, in _waitResp
    raise BTLEGattError("Bluetooth command failed", resp)
bluepy.btle.BTLEGattError: Bluetooth command failed (code: 4, error: Attribute PDU was invalid)

If I wait 5 sec before starting it again it works fine.

Yanndroid commented 9 months ago

@superpupervlad Thanks. I should have everything I need now to make it work.

It's weird that you need the L.15-L.21 in bt.py. They only print out the GATT layout. Make sure the remote isn't already connected to the PC when you start the program. You should start the program and then press any key on the remote to make the connection.

A couple more questions:

  1. Is the side key (2000) the Siri key? 1.1. Do you get any other output when pressing or holding this key?
  2. Does this remote have a touchpad (where the circle is)? 2.1. Do you get output when using it?
  3. Do you have any preferences for keys I should map to 1000, 0800, 4000, 0100? (You can ofc just change the code later on).

Notes:

superpupervlad commented 9 months ago

@Yanndroid

It's weird that you need the L.15-L.21 in bt.py

Some corrections: Without for svc in self.__peripheral.services: (all other lines don't matter) it only prints touchpad coordinates but not physical buttons. Maybe because it uses bluepy's discoverServices and without this line it can't correctly process the click. But I'm not sure at all.

  1. Yes 1.1 Yes, forget to mention it, here is the sample output:
    Output
0x39 2000
0x35 9e5b00005eb860b3b72084ffd3c2aa44292d97c1186a70e5cb105792805fcb09f1d9042a575a7d469e863ba5f7772265f2c50ad8469bb25ec95767890fce1497edd70f0993eb922428568e1c45558958ac92e42974e430c94569aa166dd148b699a65a
0x35 d402010053b86b60515baf62cff3cabb4ae3a574470d22d40ef7ea375d5a27b59b3088babeae4221084f7659cbd90c87c4ebecfa85fe1ccddb3762e1ccddd87d19334d92ba926b70331061a8c9c6b2bc0853d6e4b0fb2c020000000000000000000000
0x35 0000020046b869a6403d549aa8e1d356979e1038c5bc6c1dda576ccde71d07e857a36007a50d4d282ceff30a5f517c77ea585d1ea852132cc4a9a6250624db2876a71c9a9429d21117ffc6000000000000000000000000000000000000000000000000
0x35 0000030046b866d8134ccb62f93d8e73ee909b7786371c531f5d9e0f19e5f95ef9fe244023f08ca3ebfce2fc4c20c250b8174dc1be95753e7b7eb2ea70fc9939dcdaddb757b1a712f5107e000000000000000000000000000000000000000000000000
0x35 0000040044b807fe842cc076fd9101577e28c709f4da4e07352c3e4e81c904a721bde4920c26de7dfe93b67435673f968cd092463cea9fe3f38ba5e744e32838528fcfb1dd47fbda090000000000000000000000000000000000000000000000000000
0x35 0000050044b80db0b2d28e191d1cd05da691e0da43f2163a53fb771b087415cb2104e1b6753dd5559e1ff3c960e28bb1b584967edf831795d5476f141521780ce669b3493f090cf0870000000000000000000000000000000000000000000000000000
0x35 0000060044b81a6026b95d0226611f3811d3e3c16da1734ede57d5ed85f193f562a8bfa539385c96e6dae2f3c82550f5fd95fcc31b41e398f79829ba53e4c49ed38554f3fca120dc9c0000000000000000000000000000000000000000000000000000
0x35 0000070044b8227eb8cce9ed3070557a5c928202878cba0bde033c9f3490c008597829d7cdde00fe77aef18db7f5f6409b0e4a451eaa4dbb91f93cc73cd74b580be506424149a0db590000000000000000000000000000000000000000000000000000
0x35 0000080042b83f11e8664327a59181fa586674806dc17774710c38af21a2b0936f33e679b2844dd41d10381919adf5059db5ad0ef8513d5f28ed9fecbd772eb1e9582b20fe9ad200000000000000000000000000000000000000000000000000000000
0x35 0000090043b85089708279465f3bfc3095f1b7be7239c6a6c467caf0217ddf1ac390db4730f835deb01cb89a1500e5e87791cd5e4bcc326ff2cc9062c86b7bb15d5f741d47583954000000000000000000000000000000000000000000000000000000
0x35 00000a0043b8222a5d38d451a9216c637cc7f9d0dd6985bd30abc99500b2023e95491ec79e28d03472b647a500ce2aa1bba968996688dcdcdb1ce0ddea3fbff582d058773ed04e4c000000000000000000000000000000000000000000000000000000
0x35 00000b0044b8194b18113714aa88bb394d3f4e0fd66585300f05cda479351f90aeb93b498edb8c39da9d8d82bfdf8a4e17ecd13ccd64ef34be08a9cea678d7518f92581e80cb5b05030000000000000000000000000000000000000000000000000000
0x35 00000c0045b824fbd6f32e6eafb677098cb304841f2a554f862c3adbf7feb04e514551ab7d8456fddb07d53ca9e2415843e954907678a0c49352a28d20574a127e126d896896803368ad00000000000000000000000000000000000000000000000000
0x35 00000d0044b81b291dd44f7762fc09710f7bf6f07e7841e8a0f774fa726acfeb17b25da7bd753e8fd517d5dbde21b60bf381e107da0f8005e28eb56fcb5a0ca5bcbe2415fef39be0840000000000000000000000000000000000000000000000000000
0x35 00000e0044b8222f4b42eb1b3d9c28b5e0be257f4c05fde9e92e63fab8c38d915da50cc5ea52ae71e13dee19178e89348b0de5f28a0de75262c9c13754ef40748aac73dc0cfb68ec3a0000000000000000000000000000000000000000000000000000
0x35 00000f0044b82274586c83e11ec77f10fd93c0a34d9e230f65f36fb9d99179ad1dfb81f714c6e485cfc470a24c69fdc8e3774f101a983621939af1ab0d13453eeb6487c3b9487558700000000000000000000000000000000000000000000000000000
0x35 6a01100043b82a0a0256f9125250428afff5e8a3f315a32893c66b045a65716e0d7f2c64b7887081980043cc6fde731ec18fa410addf60319b6a9eb60f189f4e513d1edfd2fea68d000000000000000000000000000000000000000000000000000000
0x35 ef03110045b829db4f6554fe47b8e5a03e7654dfaf72aca27c581c6ea26bde48825873bbcb6cbc929da72b6bc7494f49ab2c426d163a18e1b73a10dca1175d6099effe5757bc695b61d600000000000000000000000000000000000000000000000000
0x35 b500120047b862882e8db066058a349856abedab11495625d3262fcd2926ed1f4d24342fae1f3c1326ddefeb576ecbaac7fe0b5aad9c13e879993a78be8b6a8447736b2008f153d44901c5a10000000000000000000000000000000000000000000000
0x35 6a01130044b82309d3371970265f2e8d0f7019b6b9d7e62ec34f11b2ef6f9dbda8de04b65a222a477c479f5186f48260c8ff965c4072189a2c822184c84afc2c2faa9f28d07c1112750000000000000000000000000000000000000000000000000000
0x35 950a140047b854c0cae3c99e6924c4a2e7d1a3c4efc2fd8144851eb5141179263407c2b38a9a2eab4782b29ffe8ba7feb22ff0a087fd67437bbd6f5f8713d4c3326e0555431e44b8c991f7530000000000000000000000000000000000000000000000
0x35 af24150053b86c94b0f1f219ac56e0074e21554cb1ac8938a22665a75da515182000c1eb1d67709d24560cbd5ea493473ea2640790807f5b94536e92471b7ede99ddcbe246c5e0c4c1e1c7ba34eb444e5c9bb335058071320000000000000000000000
0x35 f83116005eb86ca9f3215b13b2b72cc25a4bba528d925dba90cb6cf1272215118d0fb0ae8b0f0e62ebfeb4645676ccd0c14106be2cea4eed353bb1ce090369bfa8dc0f18df691fb5b092572f0ab301ce5229fda00096ca548ccca9f7ff4d6c9e33d19c
0x35 2a3517005eb86cba70d5e4a38fd7325f7c6acfaaba0fccc6a34c531d84192643769c542cc1f7f2eb4a4d6bb160671e958c0afabf6adec89f76e55ddca54fed66d132e743b84cbd8eb60274b11ad9b653b17dcb932444b0a372967c898b1629349a884a
0x35 332218005eb846bdb5760e4b040a40304a08f56799f98d8dc57d3b377963bc8a7feca0a4d99cccd25131d256c33213941fb9c2b187430faa74c2ec128de6a2e57baea16857b059e8d5bbaf9e58074840cf9f542afdc30c6cd484feb2cbfc087241f81f
0x35 c91319005cb86b17eac029ca9672f038e33d69b469986dc7b3175e95b127d2963ad70aabbe6493cd0294f026bbfa17b43f755a23a2ed93c5bd046678a5c0069351b46937175d809f907b2445b94e15f8bc213a70a54a35f88797ca995b479d25f50000
0x35 8e0f1a005cb86b17e0d1422d7a3aad209eef4758c04cae570846badd9ef3fe4e262bb582abcd0b8a160491a5614d2a8e90f2de06eb821eed5bb430c914fd75602c404fd72d2d167a723389e1c85e94870a48ae2dc3a2c71b0067ee88e00a18197b0000
0x35 8f0e1b005cb82b8fcda38fe92c8dd35650ff953d4f90d9a2d6a6de485ce9df193671858205594eb947068b8c7f15cf94b8b90fc723e1c7bc076d623572591921ed036b7f5c8edfc08dd9695f4a5efe0e2b1dcf808357372ac321b19f8c5768523c0000
0x35 8b0d1c005ab825f959034e710c620ae5e54e728794e7cc6f0d938dcbe042496e35305d331381b13ecb4d0a6d46387eb83b13b5c6b9d181afae524681ba9439a12e9306b029aa53d84ce12820f495769463e9ffc3e3f3a53e7d4c91da1237b700000000
0x35 d10d1d005ab8262197210cc1bad8e9e84bfaa352013e91544d57f18af5b730d0d14dd737051a2996e92c3979be7d647622cb016a89008c54a4555c661646ffac4c8a27380230d54fb8c9d6857dd140ce94c647e6ce545f238887caed87176f00000000
0x35 e50b1e0059b8267aa7016242e82a98bd4864ac501bdc56d46792e8eacb61ffaa41b709c3de21a7af3a108348b4f36244014fc7375a6072247f811e95c1b0664acc0a9247e19ca467ab3f29ba90d272b4adebb5e3e6f0853514cc9872e1970000000000
0x35 df071f0050b82e51b78b3a1a16f5539e845796beaa1a8549cb398f2b4b0515998f1cecb500037818b8493604bfd200aafcfe7e4589701c5ce3ade47b387355ac9d763a7f2401cc91ffed35e1d729c244df4be819780000000000000000000000000000
0x35 c806200046b83052c8b2c3aa65d8262076d0f9f8e75c0edd455e3b5051f8b5739df1f2f0c2072889b5497fa990bb4e139abfff114aea34fa2a78e02774f4657d7d73d0073578d0de186ce5000000000000000000000000000000000000000000000000
0x35 d405210046b868e2e0ba63309855d0c6acba24c43997e2fd3fb915db8de090a18f359bdb017ba6ec5baf8ae34859f7fa0c013666b22f5461e0c604e12b97d035daf432d4b805eab17a781a000000000000000000000000000000000000000000000000
0x35 2e04220047b82f15df0a2aec09e684aed60d4660d76d732cf2445573f5ad0c5c3b7f42f3fb51130a2d989772c1c39e4e3db685e118fccd80fd6aead5cb0a1d0120fc705887a984bce20f0a300000000000000000000000000000000000000000000000
0x39 0000
0x35 b500230044b8231b616f3b735b8bb4e6feabe53c89acf3d557d25f4e54837b1202f86ba84752cddfbbc22f988cd5f1a429a4cd4074965ee9b4ac1738310c872dac5a859ef697181ab50000000000000000000000000000000000000000000000000000
0x35 0000240046b83ecb3a0a9cd5eba2b5e0d3e75df08379373fa8b9fe2c9830a91fd6afc496768f68aa5188fa1198c76bb12489e7e0da8e2d7a96540ebc24bda28574dfb3930c419055f85c63000000000000000000000000000000000000000000000000
0x35 0000250044b8680097ddf09e381620092f09c5274616cf938fcb37e0de8cc5736ee80a2b146c06184d3666497f573653f5a6806412b949756ec3de0e2d1b29d09f71d0d8d470b144690000000000000000000000000000000000000000000000000000
0x35 ff01260053b8637608fac8e0264fa5bd499e15637a07667b68c21f9457b999d85773102c7d6bb5128c41f51d27dd05a97de70a430493cccdd9f1a35a7ff737b3f64d322f338e4d24252db160ee2147ebdb1cd325789f1c550000000000000000000000
0x35 6a0127004fb86bf7bb63e1f9f4369c891cef7fd8484c147efb00b92ecfc5bd62f091b7762e2bbf381eee4cbc3bdab66213af153e250029a3f0cfe5b819aca53539e0ea1546c544d9354c0e17d481bd1c82bad632000000000000000000000000000000
0x35 6a01280051b86bf1fad8d99e26f97c168b9f99b04001b49923f5e4beba6d2a91ffd8d3692e1be5ebb7e81e0bcd106236cd05cf8d21a1699d895809f7d0ded6c2f156f95d522f00ee10a516914c242e4a5d16310420ab00000000000000000000000000
0x35 ff0029004db814df756e856f0de889f8944fb9d44a9778231af01a63678f363ea9c72aab78cdfdc083e9155c4a5346c2d0ee4a513b4f1d70addebe8445fb058720c17c7dc950db34200ff9cedc7fb0fe41a20000000000000000000000000000000000
0x35 ff002a0049b806c5bcce96a838e1d4459708f20b6aa14bc195ac216e109000392d394e583d22256acaf9a20cb57975d1dfccccbbacd6d4e6adf6bcad349588e13ad93560f94beb9f99694f18472e000000000000000000000000000000000000000000
0x35 150c2b005ab857f8082993461f4ecd3eaa9a83114bcecd2f0234945c4126c044fecfaa95f4ba709b31ff000826d477459d88948e79adf233f69ddc5bcd8fc8e8804904269b9b8aa3e3722a83521b03f5583c6bc6838c53f2fdd2866fac83eb00000000
0x35 c80e2c005cb8692238737990a8c8ad36baa9c959506878101fa2000a6e209b1c8ec0972d482e94efd9fba79c044a556e1d6b841990bb501ff30b2911724b0b15dc9e09cd1ebd95fb2d4ef8bf8791a71af223a5dc87fc4e21f7911df179c187907c0000
0x35 900d2d0057b82be316dde9efb1090e841d5539f8e5e6ecca141c57f9f58f95c0ba8a247fb9a43be669e12b04bed2e0739b48f44762792ec709f5dc7638aed7cea2e2085ec8f3d1941f4a03c9e80a1a2b30ba401fad51cbd4a8e357b300000000000000
0x35 a30b2e0054b8277af423aa6513ea540e15ae9f5019991a5f2b94b203e4cbfce29daf787604814877524202d8d448abde033830d454f2dc877ce282067b306651a0fbaa28238acc7ec658e563cc9e2e84e95927fefa37ced77d00000000000000000000
0x35 1c0b2f0052b827c6b972345ed4c540f2704557b01a13fadc5e41a68eeef28e726b3a280290658a7e28aef5f005946d614c1a9b58a7ce8c8d844921850f864f8febfea0512ec5d3c14f7f96cad79ba8fa27850f191e0526000000000000000000000000
0x35 830830004fb82610ac46ea0e550146618155868d8b75c99595aec1a674312c606f41a99fae67223c19485867f1c006d1c4b1ae212782fbd938e0910d165cba15256a8aa59d9ac3b4b8e335846853b2175dd790ea000000000000000000000000000000
0x35 6c0831004bb8272cbe926c7b3c607465785fa040773d36a26c6ea00bd8d818889f7688022921e220884ff3f9880556a973cecc956a3c2721879bbbd9a652bac1e69162bb22b5d718697d1740f681671300000000000000000000000000000000000000
0x35 d209320047b82f08aa727dd11346ed06f187d20894c70492a4538007f6510b6199f5cd4193bcb10350bcd1b45a02ba9b7d53a9b6b2a5cc0e3c6d0d194d052f67b9cee7ac23613e492487847f0000000000000000000000000000000000000000000000
0x35 660d33004eb849a95dee99c14b40de20ed9a74b5451c05014f4c29bb1d6bb1a4ee0634a215ab06a7b668613425864af52024b76ece653f9ca4c1a41851c2bd2acaa039ca2973536f3f937b49a82981ba85586100000000000000000000000000000000
0x35 1413340058b83721237f2b85663bc4191caf9bf91b953a12b3619856b14067d76e05d79b23508c8aa94875125b4b3c9e37c1f23c698ec213d02c0009875ed9b31c6a5806ee126278c33a2b63d53957a6119223acf6d67890ba4eb0f5df000000000000
0x35 f505350053b86ad1e318f0cd6e78c5474e7bddeb4beaea7a2da831959587086242ebb0c787c6478399f5ac0fef2bc99d86e49fdf01ab05fd983dfc0562336bf15931a9967968e3703562519192fd951b1f71b53771971bc00000000000000000000000
0x35 7a0536004eb832afc9163e74348c5da7f70fec0061239c57e7125610e7e95adfd850088c8cf5631642cfedaa545ec3a61478e6d2811db273846676d2c59246c92666e971eba6b3ff909ca545fcad10f379c22000000000000000000000000000000000
0x35 5d0637004fb868e75f8ca70cb6cc5cb7d55c2e407044e8c3dfac970c9350bd6dcb1d2db32c050ab2b89d22528599455c26c1a044c40f1812e65ba1f4868d1cc670fe1a94ba7c30b1f60b7d89c6f0781120231e28000000000000000000000000000000
0x35 ff0238004fb80bc8a369ba3e53a2e6dafbeca8c8cdcc8f923a92ec87b73ce64e442ee751a8eb6f743c34f4ed317a3e9f98c77f02ae2411d933827fdaa2557b39694cd313875365c83cc454f37fbf28b02ba1404e000000000000000000000000000000
0x35 510339004eb807083d47294b315a6a633d1ec87d2299ba5993a382d16ac6298cff823c90fe96555d0eff750321f86a006d715251fcb61a83d39eae7a157fa4297a69eb0e3e5111a3aea6238db65de9770f1f1e00000000000000000000000000000000
0x35 d50e3a0050b82f852dbe47603c282ca374bf5973b62718d8b25a0e65fe6b5a7ed6ae42bc8acee566b29506900faf9d3c3db2d669391d4197505f421ba660eaa13ced0d12e0c377606b50da8ad258567b0939a3fda90000000000000000000000000000
0x35 fd133b0059b855d226392850ff8cf89e3930b08dba8d41a80eccbeb626acc196c0a9a4747fa9be4862adef3768b2642f075e57d85466168615bfe3e750ea001c6f78d595c096b79b66020c89814a972aa8d5b3ea743458e45200902f4c1b0000000000
0x35 1d113c005bb86ac6136f5cbc6490655c33daf07b484ba3a9ebefb0feedc9e9684548d3f0a2948d2be4dbeb5b6edc8f0e2ffa6e096f3f01f37cbe82c53807bf7ea225741d9092d2f131952f7d6e93217c3c28d1f55a895794bcb5cc42c541a5b8000000
0x35 20123d005cb8356e7e2fba44c21fc83a3d8901585f2738de1a20ca1709ab80236fdc54562ec9a406b5e7239c556071a06d48cd8d8aff0d84cda4ca538f5c5167d94b01f1b9d5ec684609d853918c9527196dd42d4014f4136ebacd20c04855dba10000
0x35 c40f3e005eb869818861c9799a08d790c407fea04c46febd91afc8c94c541c9f6d5213e9e8890f169bdccaf61637f0fedab322946575a52cbe2f7e12ff1b28148df5a2bdbdf618f2659bb51357806098db945b2dbc5b7172a8a1248804952fc63f1605
0x35 340c3f0058b83575c25f6e2958416bef171c3d9e56231fc6dc6052aa10e802a5bf5ac479705c930fa8240832332c6a29daa85265f9a3f0da5bd74ac609f7cb7601f66586e8f47062c5a4455c200f4b5d4e6690ba5e18b8a90e3ed18d0a000000000000
0x35 ea08400054b8275faecc31ee08e8cedd4e457785c139f0cd2f6633c58ef4d6eeae82c11e838da35441f5e9232a21e5a654a880feb15d2d2048415631d980d0ee7e5a99115578e42c547fa518cb99c5b2a94b7215ff2337106000000000000000000000
0x35 a20641004fb80bc72125f4ac1a1dd346fb40f38e5e8d22ce38bbf61f3d0005b788a01d31201991293e7528008a53453e262982fe2d973ea8a7f16052523455edc916e145c1ab3f28ee1422d8b1c27105e51ac35f000000000000000000000000000000
0x35 e60442004ab82a335e9c634aaa9b56ff8f3db335d2275193b2c3822bad0133f56adc24834334482bec2c22038f47f11ff4a14489da2f956bf16f0df4e5e563cf18b502b9466737706382b8070c06d10000000000000000000000000000000000000000
0x35 be04430046b865593f0890306050639dc0f5971e1372a40a566a0a6e541682548200b377420cba40f180dd101c54b3b3d266c6ca8e19b2925a8e74a0e084a24b3e361b0488df80570c1332000000000000000000000000000000000000000000000000
0x35 1f04440045b82ef77a3d9b6c5a0f605823b526dd6e0c5f5a12441b4cc243512f6d1b078e19a757f6e4052af67b6feb05d4b925d292128007941189c2e6447d17c1f0be176a95202cfbb800000000000000000000000000000000000000000000000000
0x35 8903450044b8381633433b9fbb707ae0b59e07296571cac714c233b08ed17202d7a874b67056430b7ec12e9433886ffb24dcabc16ff88d172998a395701a92c3bc8a615e6cccf4ce220000000000000000000000000000000000000000000000000000
0x35 6a01460043b807cf0099fa68d2628db0d828aa0dbb38fbdf299cd57623899e7522a917a6a507e1fe255432dea6ac88ec99b119e1bc3b88e0feffeea982bd0bddf14fcf4300507039000000000000000000000000000000000000000000000000000000
0x35 0000470044b83f6b66ad178a52b1a146220f81b6f0d9160f647c417782b9125bf8e9002886b775e0b1d1827467fec36f8fd60bd9679c919c6707a7ee7a2c616fe33dd368826ec9e5b80000000000000000000000000000000000000000000000000000
0x35 0000480043b83f336f30614e1a7ab31e2e017723ae2d1cc6882d4383ac422b251d554393fa8d1762e9a22312a3c77c2c25bfe4ad33d29c26de353aec9e32c5d4e6e94ea27f334b86000000000000000000000000000000000000000000000000000000
0x35 0000490043b8146a01b6251e6168ccf7f3680ee838e100ff4b240e6c87953b6ae13e13a0799e2c797d6b6f25be9bf8ca0d1306ba11c7240b4603f8d9f769003e5433f8e5790c1d6c000000000000000000000000000000000000000000000000000000
0x35 00004a0043b82272d4bb9c849f60058d59530f0316a6af714884f1bc4ecd2f1eed4152a47720bd56de3d78d61b1f8f60b15ef859a8905f6129a5a5b320bd51d69685ded1365c0f9a000000000000000000000000000000000000000000000000000000
0x35 00004c0043b81b3d80e7edd7ba70916f1f89425d3bbbc25ceac1cc62a3c2728d029c7227040508e217eb383d30b1ecfbbdebb4a3c7d08273a63a813125efea2776ee5631b02618e9000000000000000000000000000000000000000000000000000000
0x35 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

  1. Also yes, and I also forget to mention it.
    Sample output where I slide it clockwise
0x3d 325038015b6f0e5f500aab
0x3d 3270380172af0d5e510bac
0x3d 3292380181ef0c5c4e0bac
0x3d 32b43801901f0c5a480cac
0x3d 32c438019a6f0b59400cac
0x3d 32e63801a97f0a58360cac
0x3d 32083901ba5f09572e0cac
0x3d 32183901ca5f08562b0c6c
0x3d 323a3901de3f07542c0d6c
0x3d 325a3901f2ff05562d0e8c
0x3d 326c390104d004592f0e8c
0x3d 328e39012860025c2f0e8c
0x3d 32b039014440005f300e8c
0x3d 32c8390154e0fe66320e8c
0x3d 32e839016dc0fc71390f8c
0x3d 320a3a018590fa7c410f8c
0x3d 32223a019b80f886480f8c
0x3d 32443a00b690f58d4e0f8c
0x3d 32643a00c720f38d520f6c
0x3d 327c3a00ce70f18a550f6c
0x3d 329e3a00dd10ee89560f6c
0x3d 32be3a00e120eb8c550f6c
0x3d 32d63a00df30e98a530e6c
0x3d 32f83a00db50e57f4e0e6c
0x3d 321a3b00ce40e26e460d6c
0x3d 32303b00c060e0613d0d6c
0x3d 32523b00a780dc57370d6c
0x3d 32743b008b90d94d370d6c
0x3d 328c3b006cb0d648370d6c
0x3d 32ac3b0045e0d348350d6c
0x3d 32ce3b001c30d14b3a0d6c
0x3d 32e63b0000b0cf51430e2c
0x3d 32083c00c9afcc5e500e0c
0x3d 32283c009ccfca6c5a0f0c
0x3d 32403c007effc974630f0c
0x3d 32623c003f2fc874680f6c
0x3d 32823c000c7fc7796c10ac
0x3d 329a3c00d82ec7816f10cc
0x3d 32bc3c00a27ec7887011cc
0x3d 32de3c00566ec8876d12cc
0x3d 32f43c002eaec9836d12cc
0x3d 32163d00db3dcc816e13ac
0x3d 32383d009a0dcf826e13ac
0x3d 32503d00733dd1866e13ac
0x3d 32703d00268dd59470128c
0x3d 32923d00061dd8a073128c
0x3d 32aa3d00d99cdba875118c
0x3d 32ca3d00b44cdfa977118c
0x3d 32ec3d00970ce3a979118c
0x3d 32043e008d4ce5a97b116c
0x3d 32263e0078fce9a47a106c
0x3d 32463e00773ced97790f6c
0x3d 325e3e007e1cef84750f6c
0x3d 32803e008b0cf3716e0e6c
0x3d 32a23e00a7ecf665660e6c
0x3d 32b83e00bddcf85a650e6c
0x3d 32da3e00ecccfc50610e6c
0x3d 32fc3e000bbdfe4a5c0d6c
0x3d 32143f00254d00465a0d6c
0x3d 32343f00489d0246600d6c
0x3d 32563f00679d0447660e6c
0x3d 326e3f00779d054a6c0e6c
0x3d 328e3f00902d0751710e6c
0x3d 32b03f00a56d0856740e6c
0x3d 32c83f00b77d095c750e6c
0x3d 32ea3f00c64d0a64760e6c
0x3d 320a4000d95d0b6b740d6c
0x3d 32224000e3bd0b71720dcc
0x3d 32444000f68d0c716e0ccc
0x3d 3266400006ae0c6f5e07cc
0x3d 327c4000125e0c694603ed
0x3d 329e4000125e0c000000ef
0x3d 32c04000125e0c000000e8

Sample output where I slide it counterclockwise ``` 0x3d 32b61d01ddbe0e494f08cb 0x3d 32d61d01d6ee0e4b52096c 0x3d 32f81d01d3be0e4b56096c 0x3d 32081e01d1ae0e4d590a6c 0x3d 322a1e01cbae0e4d5c0a6c 0x3d 324c1e01bfae0e4f5e0a6c 0x3d 325c1e01b4ae0e51600a6c 0x3d 327e1e01a6be0e53610b6c 0x3d 329e1e0195ae0e55620b6c 0x3d 32b61e01848e0e58630b6c 0x3d 32d81e01664e0e5a660c6c 0x3d 32f81e0142ce0d556a0c6c 0x3d 32101f01282e0d4b6a0c6c 0x3d 32321f01f9cd0b42600c6c 0x3d 32541f01d32d0a3c560c6c 0x3d 326a1f01ac3d083c520d6c 0x3d 328c1f0183ed0542500e6c 0x3d 32ae1f014c5d02454c0e6c 0x3d 32c41f01345d004e4d0e6c 0x3d 32e61f010e5dfd755d0f6c 0x3d 32082001eb1cfa8563106c 0x3d 32202001cddcf68f68106c 0x3d 32402001ab2cf29369108c 0x3d 32622001a46cef9869108c 0x3d 327a200099aceb996a108c 0x3d 329c2000936ce69166108c 0x3d 32bc20009d2ce2835e108c 0x3d 32d42000ab8cdf7a580f8c 0x3d 32f62000c73cda73550fac 0x3d 32162100e1bcd76f4e0eac 0x3d 322e2100044dd46a470eac 0x3d 325021002dfdd067470dac 0x3d 327221005cedcd6b4f0dcc 0x3d 328821008d3dcb71540dcc 0x3d 32aa2100d7fdc76d550ccc 0x3d 32cc210002dec666520bec 0x3d 32e421003e5ec5604f0aec 0x3d 320422007d7ec45a4f0a6c 0x3d 32262200d7eec34b510a6c 0x3d 323e2200019fc440490a6c 0x3d 326022003ebfc53233096c 0x3d 328022007b3fc72825086c 0x3d 329822009d7fc8221e096c 0x3d 32ba2200e5cfca201a096c 0x3d 32da22001320cd2317096c 0x3d 32f222003fc0cf2a1c096c 0x3d 321423007c80d334270a6c 0x3d 32362300a9e0d65a3b0a6c 0x3d 324c2300c250d9623c0a6c 0x3d 326e2300e4f0dc693a0b6c 0x3d 32902300ffb0e06e390b6c 0x3d 32a823000811e374390b6c 0x3d 32c823001c01e87b3d0c6c 0x3d 32ea23001cb1eb80400c6c 0x3d 3202240012c1ed7f400c8c 0x3d 322224000301f27a3a0d8c 0x3d 32442400ebf0f472340d8c 0x3d 325c2400d7a0f66e320e8c 0x3d 327e2400af40fa6a320e8c 0x3d 329e240089d0fc68320e8c 0x3d 32b624006110ff68330fac 0x3d 32d8240036300168340fac 0x3d 32fa2400094003683e0fac 0x3d 32102500ef6f04694a0fac 0x3d 32322500c7ff056f5610ac 0x3d 32542500a24f07755d0fac 0x3d 326c250090cf0779610fcc 0x3d 328c250075af087b630fcc 0x3d 32ae2500605f097c650fcc 0x3d 32c625004fdf097c660fcc 0x3d 32e62500443f0a7b670fcc 0x3d 320826003d9f0a7a660ecc 0x3d 322026003bdf0a75640ccc 0x3d 324226003d9f0a6250036d 0x3d 326226003d9f0a0000006f 0x3d 327a26003d9f0a00000068 ```
  1. Nope
Yanndroid commented 9 months ago

@superpupervlad I made some changes in the gen-3 branch. Tell me if it works :). (The touchpad might do something completely random)

And, is only the ring touch or also the circle in the middle?

superpupervlad commented 9 months ago

@Yanndroid At first I thought that I broke my bluetooth again because nothing happens after I ran the script. But after some debug I add this line to the end of Device.connect function

self.__peripheral.services

and WOW this works great!

  1. Mute, volume up/down buttons work as they should.
  2. Play/Pause button acts as XF86AudioPlay
  3. Back button acts as XF86AudioPrev
  4. Monitor button acts as XF86AudioNext
  5. Siri button as right click
  6. Power button as XF86ScreenSaver
  7. Up/Down/Left/Right as arrow keys
  8. Center button as left click
  9. Touchpad is also working but was mixed up with audio in the code: 0x003e hid service for touch and 0x0036 hid for audio. Touchpad moving the mouse correctly but sometimes with new touch it flicks cursor to left or right by half of the screen. Both ring and the circle touchable and can recognize 2 fingers (but now it obviously do nothing with 2 fingers).
Yanndroid commented 9 months ago

@superpupervlad Thanks. I added the changes to make it work correctly. For the touchpad I'll take a look another time.

What you can do maybe is uncomment the L.33 in bt.py and see if, while using only one finger, the output is sometimes longer (18 bytes instead of 11). I had the issue that sometimes a second finger is recognized and I removed the fix for this in the gen-3 branch. Another thing you can check is, if you release the finger, the last couple of outputs have zeros towards the end. (Like the samples you gave me). If they do, the cursor shouldn't skip around with new touch.

superpupervlad commented 9 months ago

@Yanndroid I think you misunderstood me about cursor skips. I think it's not related to zeros because they always appear when I release the finger. I record the video with this skips. When I move finger from center to the right side of the circle cursor skips to the left, when I move finger from right side of the circle to the center in skips to the right. Also there is strange skip near the right side when finger turns a circle.

https://github.com/Yanndroid/SiriRemote-Linux/assets/6016099/69627e9b-9d49-4709-95ae-c88bb9c688c5

logs.txt

Kate6 commented 9 months ago

Hello - just wanted to comment that I've just tested your gen-3 branch with a gen2 Siri Remote and that it seems to work exactly the same with it, right down to the skips in @superpupervlad 's video. The skips happen when moving my finger back and forth between the center part of the touchpad and the right side of the outer ring, just as @superpupervlad describes with his gen3 remote.

By the way, it would be super nice if you could update the bit in your README that says the device's MAC should start with 48:A9:1C... I spent an embarrassing amount of time monkeying around with bluetoothctl thinking my remote was faulty before finally figuring out its MAC actually started with 60:BE:C4.

Kate6 commented 9 months ago

... I don't actually understand why, but I seem to have fixed the touchpad skips like this:

    def __decode_finger(data):
        x = int((data[0] + 255 * (data[1] & 7) - 230) / 15)
        if x < 0:
           x = x + 150
        y = (data[2] if (data[2] & 128) else data[2] + 255) - 188
        p = data[5]
        return x, y, p
Yanndroid commented 7 months ago

@Kate6 sorry for the late reply. I changed the readme according to your suggestion and also added your fix to the code. Thanks.