Bluetooth
Timo Hartong (2813) 204 posts |
I think I made a topic in the past about this. But it seems I cann’t find it anymore. I try to do some work on the bluetooth stack for RISCOS. One can find the work here. Please note it is work in progress. |
Alan Robertson (52) 420 posts |
Hi Timo As Sheldon Cooper from ‘The Big Bang Theory’ states: Everything is better with Bluetooth! |
Dave Higton (1515) 3534 posts |
I’d also be very interested to know. I started from scratch. Just me and the BT standard, which is well over 3000 pages, and some USB captures a few years ago. I’ve been working again on it these last few weeks. I can get communication with the dongle, and through that to a mouse, but I haven’t got as far as getting user data from the mouse. The trouble with the standard is that, although it tells you what you can send, what you can receive, and how to interpret what you receive, it doesn’t tell you what you need to send in order to get a device going. |
Alan Robertson (52) 420 posts |
@Dave The Link Manager Protocol is how you establish a connection with a device. I’ll need to look at the document again and see I can make any more sense of it. It’s tough. There seems to be many different profiles that devices can choose to support to communicate to their host devices. Mouse and Keyboards use the HID profile. It’s apparently very similar to the USB HID, just a wrapper around it apparently. Which given your USB experience is useful. :) Edit: What RISC OS machine are you working on? |
Timo Hartong (2813) 204 posts |
Hi, What an interest suddenly ;-) that is nice. I’m using the bluez stack ( http://www.bluez.org/ ) this stack is used in a lot of Linux distro’s and used as base in other disto’s like netbsd. Why develop yourself if others have done this ?. |
Alan Robertson (52) 420 posts |
Bluetooth is so important. Everything is Bluetooth enabled. It would be great to use it. I’m spending today reading up on Bluetooth again and taking notes on what I think is important so I can try and understand it better. Sounds like Dave has made some great progress. He can see a Bluetooth device, so that’s a great start. I’m guessing he’s using a FOSS Bluetooth stack too. |
Timo Hartong (2813) 204 posts |
I remember vaguely that somebody was able to see a list of BT devices but couldn’t get a stable connection with it. I’m using a Rasb Pi 3B+ as test bed. |
Alan Robertson (52) 420 posts |
According to this page pairing is easy!! In practice I’m sure they are loads of other hidden steps involved. |
Timo Hartong (2813) 204 posts |
O yes for example in the bluetooth chip on the Rpi firmware has to be loaded and on low level communication will go back and forth. |
Dave Higton (1515) 3534 posts |
Since I posted, I’ve discovered that there are two Protocol/Service Multiplexers for HID: HID Control (0×11) and HID Interrupt (0×13). I looked at a capture for a Bt keyboard and saw bulk transfers setting up and configuring one link for each. I’m trying it with my Bt keyboard. When I can get it to pair, I may get user data flowing. (Or maybe not. I’ve felt like I’m tantalisingly close for weeks now. If I really had been that close, I’d have been there by now.)
Raspberry Pi 3B+, which is my main desktop machine nowadays, and a Bt dongle. I have 4 dongles, of which I’ve been using 2. I think the USB protocol for Bt dongles is pretty standard, so any recent dongle ought to work. I’m not attempting to use any built-in Bt chip.
Yes, ish. I wish someone would write a book about writing a Bluetooth stack. I’d buy a copy.
Apart from a bit of USB library code from Colin Granville to do the USB transfers, the code is entirely my own. If I had any sense I’d do like Timo and use an already developed stack, but I’m not sensible. Timo is porting a known, respectable and widely used stack, on the assumption that it implements the Bt protocols. I’m digging through the Bt standard and using some USB captures to/from a USB Bt dongle and some devices, trying to make sense of it all and implement communication my way. The knowledge we gain should be complementary.
The most logical place to do it, it seems to me, is via Chatcube. I’ve been on it for some months now; how about you guys? I can create a group, but I need another contact before I can create it. |
Timo Hartong (2813) 204 posts |
“If I had any sense I’d do like Timo and use an already developed stack, but I’m not sensible.” => That is relative. Hacking such a protocol and start from scratch can be interesting as well. |
Dave Higton (1515) 3534 posts |
It isn’t. But if you’re developing for RISC OS, you must have a RISC OS computer. My user name is Dave Higton. |
Timo Hartong (2813) 204 posts |
Hi I have installed it on one of the RISC-OS pi . I have as name Timo Hartong if everything went as it should ;-) |
Richard Walker (2090) 431 posts |
Timo, I think using some ready-rolled code could be useful. RISC OS does this sort of thing with the USB and TCP/IP code, so there is plenty of precedent. BlueZ sounds interesting, but the GPL makes me wonder. Perhaps there is something similar in [Net/Free/Open]BSD? |
Dave Higton (1515) 3534 posts |
Alan, would you like to register yourself on Chatcube? Then I can add you to the Bluetooth group. |
Dave Higton (1515) 3534 posts |
Richard too, if you’re thinking of contributing. |
Alan Robertson (52) 420 posts |
@Dave But, please add me to the group. I’m sure I’ll regain access soon. And +100 points for writing your own routines to connect Bluetooth devices. Mad, yet amazing. Is it in C or Assembly? Please say C. |
Dave Higton (1515) 3534 posts |
It’s in C. I have no intention of ever originating any new code for RISC OS in assembly language. (I have recently corrected and updated some assembler, and it wasn’t a pleasant experience.) |
Dave Higton (1515) 3534 posts |
I’ve alerted Stefan Froehling on Chatcube, in the hope that this prompt will get him to sort it for you. |
Alan Robertson (52) 420 posts |
@Dave |
Dave Higton (1515) 3534 posts |
@Alan: you (should) have email. |
Alan Robertson (52) 420 posts |
@Dave |
Timo Hartong (2813) 204 posts |
Hi Just an update. I don’t have access to a RISC-OS machine at this moment. A part of Bluetooth is in the linux kernel so it has become a bit more complex. Next to that it uses threads and processes ( of course ) so it will take a bit longer.. ;-). |