Started working on OpenBSD's bluetooth stack
OpenBSD 5.5 had partial support for netbt bluetooth stack ported from FreeBSD but it was removed in 5.6. So I took the 5.5 code and ported it to -current with a lot of help from ChatGPT o3. After a few days of refactoring it builds !
Yesterday I booted my own OpenBSD kernel with netbt and ubt devices attaching. The ubt device shows an error, I need to investigate.
The sources of OpenBSD-current with netbt stack is available here : https://github.com/thodg/src/tree/master/sys/netbt
I kept all the original netbt code from OpenBSD github looking for a commit named "remove netbt" which led me to a commit by Ted Unangst with still all the netbt code, as it was just a header removal (unlinking all the rest of the code).
After understanding how kernel config works with files and tags and options I could start the compiler error dance.
ChatGPT was mostly helpful for :
- basic information about OpenBSD kernel programming (which is well sourced with pdfs and research papers)
- I constantly asked what changed between OpenBSD-5.5 and -current to resolve undefined symbols and unknown struct members.
Mostly what changed between 5.5 and -current that I could refactor by myself :
IF_ENQUEUEand such were put into<net/ifq.h>and looks likeifq_enqueue- a few macros which used to take a last argument as a Lvalue were transformed to not take the argument and return a value.
- the
ifq_functions expect aNET_LOCK()andNET_UNLOCK()around them.
If there were other changes or the original code simply does not work I have no solution but to ask around me and I will try to fix it :)