wmertens / textblade-dongler

Tools to convert a CSR8510 Bluetooth dongle to a pre-linked wireless USB keyboard
MIT License
35 stars 9 forks source link

would it be possibe to modify the script #9

Open crazyjnz opened 3 years ago

crazyjnz commented 3 years ago

Hello, would it be possible to modify the script/s to enable me to pair a ble mouse and a ble keyboard to a laird bt820 in hid proxy mode. I would like to be able the run the script twice, once for each device, to store the pairing info in usr42 as per the current script and also usr43. I'm keen to learn and give making the changes a go, or if you could provide the needed scripts that would be amazing. I have access to windows 7, mac os 10.13.6 high sierra and have blue suite so can put the dongle back into hci mode if need be. also i think i could manually enter the pairing info into blue suite if the script output the info needed. I look forward to your reply Thanks Jarrod

wmertens commented 3 years ago

You should be able to do this manually, there are two registers, but it's been 5 years and I'm really foggy on this.

IIRC you first have to set the higher register. I don't remember which it is :) maybe @awh-tokyo can assist?

crazyjnz commented 3 years ago

Thanks for the quick reply. i cant seem to be able to contact @awh-tokyo, do you know how i can contact him? or could you please contact him advising him of my "issue" post Thanks again Jarrod

awh-tokyo commented 3 years ago

PSKEY_USR43 is at &02b5. If I recall correctly (it's been a long time), nobody has ever actually tested both -- it was only ever theoretical that both would work.

I think the big thing is that you have to write them both before putting the key into HID mode. I don't think it works to do one then the other. Pair both devices using the OS, retrieve the pairing keys for both, then write them to USR42 and USR43 then switch to HID mode. The reason is that during the first boot into HID mode, it rewrites both keys to a format that I don't recognize.

crazyjnz commented 3 years ago

Thanks for the info awh-tokyo, does the pair.sh script write the key/token to the ps store or is that done with make hid.sh script? I was thinking to run pair.sh then run a modified version of pair.sh for the second device on PSKEY_USR43. If its make hid.sh that adds the keys/token could i modify that to not enable hid proxy mode and run pair.sh and then modified make hid.sh (that does not enable hid proxy mode, then run modified pair.sh (for USR43) and then run make hid to add the second key and enable hid proxy mode. Also would i edit the scripts with a text editor such as BBEdit (macOS) or some windows text editor? I do have access to CSR Blue Suite so can use that to enable hid proxy mode (change initial boot mode) Any feedback would be great. Jarrod

wmertens commented 3 years ago

I think it would be best to do the steps manually. Look at the scripts to see what they do and repeat it, but with the necessary alterations.

crazyjnz commented 3 years ago

One more question, what are all the pskeys that the make-hid.sc adds after adding the token and changing the initial boot mode?? Thanks for all your help. I will place feedback once I have tried to pair 2 devices.

wmertens commented 3 years ago

IIRC, make-hid does only that, it turns on HID mode on the dongle. Not sure what the keys do, looks like we never added more documentation than those constants under doc/

crazyjnz commented 3 years ago

How do i add the modified scripts to the virtualbox??

wmertens commented 3 years ago

You can either use the regular image and copy the scripts in place using any method, for example using ssh, putting them on some web service and downloading them, ..., or you can create a new VM by following the instructions.

cylonid commented 3 years ago

Wouldn't it be easier to use the official software, i.e., BlueSuite, for the whole process? From what I read here @awh-tokyo managed to pair a device using BlueSite before this script even existed. Using BlueSuite under Windows is also suggested here but unfortunately, the needed PSR config files mentioned in the linked PDF are nowhere to be found.

crazyjnz commented 3 years ago

@cylonid I can use bluesuite to add the needed key and i have them(to enable hid proxy mode), its the pairing that I'm having trouble with. If i could get the info into the correct format i could use bluesuite to put it into the dongle. putting it into hid proxy mode is not a problem its just the pairing part. If you have any suggestions on how to format the pairing info so i can manually flash it using bluesuite that woiuld be very helpful. Thanks for your input

cylonid commented 3 years ago

I read up further and apparently the reason for creating this script was that the Windows method was not too reliable. So yeah, your best bet is probably modifying the make-hid.sh in a way that it supports two devices. I would set-up a Linux machine, plug in the dongle in HCI mode, pair the two devices so you get the pairing keys in /var/lib/bluetooth folder. I think this is simpler than using the provided pair.sh script. Then you change the make-hid.sh script so it calculates two tokens for your two devices, one to be written to USR42 and the other to USR43. And if you are very lucky, it might work.

But all of this is highly experimental... My own dongle got bricked while trying to use this script as intended with one device despite it has a CSR8510 board.

crazyjnz commented 3 years ago

Make-hid.sh keeps coming up with a error, 6: syntax error "(" unexpected. any ideas what the issue is? thanks

wmertens commented 3 years ago

This line? https://github.com/wmertens/textblade-dongler/blob/master/src/make-hid.sh#L6

I'm reasonably sure this is just POSIX shell syntax, so it should work. What shell are you using? Try running it with bash make-hid.sh instead?

crazyjnz commented 3 years ago

Thanks i was just running it in terminal. the bash worked, now i have a error that dongle mac/keyboard mac does not exist. i know they are there as i can access them in root terminal but i cant in file explorer as it says i dont have permission, so im guessing i have the change the permissions somehow in terminal( i i cant in file explorer) any ideas?

cylonid commented 3 years ago

@crazyjnz This script accesses restricted folders, so you need root permissions to run it (sudo).

crazyjnz commented 3 years ago

thanks, so run "sudo bash make-hid.sh" is that correct?? or "sudo bash" then "bash make-hid.sh". Also another thing when running pair.sh i get a error, Unfortunately, your dongle is not capable of HID mode :-(, what would be causing that? i know my dongle is capable of HID proxy mode, its a laird bt820, and i have had it in hid proxy mode, now its in hci mode. It does not matter as i will manually pair using bluetoothctl but was just wondering why im getting the error. Thanks again for all the help guys. I'm just learning about linux and scripts Jarrod

wmertens commented 3 years ago

Just run sudo -s and then you're in a root shell where you can run commands normally.

Maybe the pairing error is due to permissions?