kprinssu / anne-keyboard-windows

A Universal Windows Platform App for controlling Anne Pro Bluetooth enabled keyboards.
MIT License
139 stars 10 forks source link

porting to linux cli python program #28

Closed Blucky87 closed 6 years ago

Blucky87 commented 6 years ago

hello, I have been working on porting over your logic to a python script for linux. I have successfully gotten it to write the bytes over BlueZ Dbus to an already paired anne pro.

I added Debug.Writeline methods to see the data that was being sent in the KeyboardWriter, copied it and just hardcoded my python script to send it over dbus using the gatt library.

I have some questions:

  1. what is the purpose of

        private void RequestKeyboardSync()
        {
            // expect firmware version and mac address
            byte[] device_id_meta_data = { 0x02, 0x01, 0x01 };
    
            KeyboardWriter keyboard_writer = new KeyboardWriter(this.WriteGatt, device_id_meta_data, null);
            keyboard_writer.WriteToKeyboard();
    
            keyboard_writer.OnWriteFinished += (object_s, events) =>
            {
                FinishSync();
            };
        }

//Sync up the profile data

it just writes out those bytes but does not seem to matter that it happens before the sending of the lights/layout bytes. is it required?

  1. are you certain that those gatt characteristic IDs for write and read are actually for writing and reading? or that this keyboard is actually using over air download service and not some obins designed service.

  2. how did you get the bluetooth metadata and other stuff. I think i read that you said the android app. is there a good guide on how I can accomplish something like this.

  3. have you tried recieving information from the anne or poking around in the characteristic descriptors or the 'read' ID ?

thanks for sharing your project

kprinssu commented 6 years ago

The code you quoted is me trying to get more information about which settings are stored on the keyboard.

I am certain that the GATT characteristics are the used for reading/writing. I have confirmed it by enabling Bluetooth debug mode on Android.

Unfortunately, the bulk of the reverse engineering was done on a weekend. I do not have a proper write up. A lot of the bytes array packing was reversed using a decompiled version of the obins app. I used Android Bluetooth logging to verify that my C# produces the correct byte sequence.

I have tried to get more information from the read. It’s been a while since I did so and cannot provide more information on it, sorry.

If you require any further information please let me know.

kprinssu commented 6 years ago

Closing this issue since it's not bug or a feature request for the app.