Mostrando entradas con la etiqueta bluetooth. Mostrar todas las entradas
Mostrando entradas con la etiqueta bluetooth. Mostrar todas las entradas

miércoles, 11 de julio de 2012

Bluetooth Documentation

In the past I got to know that motivation comes by streams, I did not worry too much, and said to myself that it was just a matter of waiting for the next stream. The problem is that it has been near 2 years of non activity, awaiting for one of those streams to come.

Real life temptations, and the increasing responsibilities during these years, have eclipsed the free time. I always had backup plan, but the Economical situation in my country has made think about having another back-up plan, of the backup plan.
And a third reason is some property I just acquired to accomplish a life dream, which is taking all of the creativity remaining on me. It is a piece of land in the mountain, with a ruin house where I am trying to build my little own paradise. Much in the style of Frank Herbert (Dune writer), coexisting with nature and environment converting a dry and abandoned place in such little paradise. This is also explanation why this blog might change radically its topic.

Back in third quarter of 2006 after leaving yellowTAB and Germany, kind of decided to leave the BeOS scene, but then I was back 1 year later in 2007, writing a Bluetooth Stack. So it could happen again, I have been and I will keep subscribed in mail lists, follow the news, reply questions and offer all support I can. I’ll be around as I was up to now, just not likely developing.

So here is a piece of overview documentation of all I have been doing these years(dia format):


L2cap under network/protocols/l2cap:  Provides socket interface to have l2cap channels. L2CAP offers connection oriented and connectionless sockets. But bluetooth stack as this point has no interchangeability with TCP/IP, A Higher level Bluetooth profile must be implemented

HCI under  src/add-ons/kernel/bluetooth : Here we have 2 modules, one for handling global bluetooth data structures such as connection handles and L2cap channels, and frames


H2generic under src/add-ons/kernel/drivers/bluetoothThe USB driver, implementing the H2 transport

Bluetooth kit under src/kit/bluetoothC++ implementation based on JSR82 api

Bluetooth Server under src/servers/bluetoothBasically handling opened devices (local connected fisically in our system) and forwaring kit calls to them



Bluetooth Preferences under src/preferences/bluetooth
Configuration using the kit


Test applications under src/tests/kits/bluetooth


There is a small prototype component which is not here documented below  src/add-ons/bluetooth/ResetLocalDevice. Its intention was to be an add-on of bluetooth preferences, So that new HCI commands could be customized by users or external developers. I did not like at the end the idea, I did not find the flexibility I wanted.



Whoever is interested can contact me and I can share more documentation such as roadmaps and TODOs.



Thank you all

sábado, 28 de agosto de 2010

L2CAP next steps

Summer is still here, productivity in code is one of the lowest ones since I remember. Summer is to blame, hardly remember which update i need to give now.

Related my development I did a small incrusion in Caya development, implementing some features I needed to feel comfortable regarding the chat windows behaviour. BTW last release with MSN support!

But focusing on bluetooth L2CAP and its sockets interface has been a bit improved. As we said in the previous post, Haiku could initiate a pairing process and establish a communication link.

The next step was to allow Haiku act as a client to request opening a channel in the given communication link to finally interchange real user information from node to node.

There has been implemented a test application in src/test/kits/bluetooth/l2capClient. I was able to request pairing with a device (a Motorola V5), open a communication channel and send dummy data to him. the phone obviously did not understand information, and closed the communication.

Still unmature and some configuration parameters are unsupported, but if both nodes are Haiku, they could send information that each other understand. Therefore with that implemented some small applications could be implemented to have 2 haiku nodes interchanging normal user data wireless through bluetooth. This opens possibilities to implement small custom and non standard applications to:
  • Chat between 2 nodes.
  • Send flattened BMessages
  • File exchanges
between 2 Haiku nodes.

viernes, 10 de julio de 2009

Bluetooth Status

There have not been any huge steps forward in the current status of the bluetooth stack, but many small ones which give a bit more visual, and development comfortability:

Little icons for devices list: Jörg Meyer, drew an identifiable icon according to the device class instead of the former empty black square.

Debug information: The bluetooth console opened by the server has improved its debug information, being more clean and formatted.

Close and start server, maybe one of the oldest and most annoying bugs the stack had. The USB pipes of the h2generic driver were not correctly cleaned, therefore at closing the device driver(Quitting the server) compiling the server or the kit and trying to start again the server, to test the changes, the stack was blocked due the usb pipes. The only way to test again was to restart the whole system. Consequences, now you can start the server and quit the server, plug and unplug your dongles. In a user side these are not common operations, but the development is going to be a bit more comfortable.

SetDeviceClass: This is a new method added to the bluetooth kit although it is not in the JSR-82 standard. Once the device class is set, and any remote discovers the Haiku node, it will concretely know if this is a phone, a printer, a GPS, or as we will set by default, a computer. This was an option in preferences, but until now it had no effect.

Here we can see how 2 dongles(BCM2035 and CSR bc-4) in the Haiku node have been discovered by Windows7 as different Device class(handheld, and Laptop).




Deskbar applet: Finally! Michael Weirauch took a day and sent me this patch which adds a deskbar addon, where we will place the most common actions. Currently the ones placed just help the development.


domingo, 22 de marzo de 2009

Important change

In the last week, due a more advanced implementation on how HCI commands are created, I checked the possibility to start using the size value given by the ioctl's(control hook on drivers). On R5 the value was always 0, therefore I was forced to pass in the first 4 bytes of the buffer, its size.

This ioctl's feature works as expected in Haiku, therefore as this new mechanism for bluetooth commands assumes this fact, the R5 behavior, although present in code has been dropped in r29639. Check inclusion for define BT_IOCTLS_PASS_SIZE.

With the new mechanism memory leaks allocating commands are solved, as they are meant to be allocated in stack, and dropping this R5 legacy, we are using 4 less bytes of memory per command (considerable as many bluetooth commands are just 3 bytes).

Bla bla bla, sumarizing the important part:

*** After this revision, be sure you recompiled and are using an updated version of at least: h2generic, bluetooth kit and bluetooth_server. As this change solved many issues but broke many compatibilities ***

For the ones who test often, there are some strings more on the LocalDevice panel information (preferences), there you will be able to check your dongle's bluetooth version, and the company who maufactured.

I use this update to thank Edwin Erik Amsler, who has shipped me some bluetooth devices to test, and a bluetooth 1.2 dongle which was recognized by the stack:



the phone discovered:

domingo, 1 de marzo de 2009

The Inquiry Panel

Maybe this is the most visual thing the bluetooth stack can show.

I have 2 bluetooth dongles connected: "CSR - bc4" and "Broadcom BCM2035". The further tests are gonna be pair the one with the other despite they are plugged in the same host. But by this way the input and the output are tested at the same time, as they don't know about each other and there is no such thing as loopback device in bluetooth context.

In the video can be seen how i set to discoverable the CSR one, and leave selected the Broadcom one. This will be used for the inquiry process. After the scanning and the retrieval of names, a phone and the CSR device are listed, and can be added to the Remote Device list.



Again UI suggestions/mockups are Welcome

viernes, 9 de enero de 2009

Preference & next steps

In the next months all work is being focused in the codebase of the Phase1(ARCE) of the project. Three main things, fix bugs, clean, and implement features and tools which will make starting the Phase2 with a more comfortable Bluetooth base.

One of the most annoying things is that the bluetooth_server is not recognizing the hotplugged dongles on the system, they must be plugged before starting the server. So basically the management of the device(s) plugged in the Haiku system must be improved.

The second big one is the lack of tools, there are 2,  one informational, and another for discovering, but we cannot yet(in svn) take any action. The actions needed by the tests were taken by the remote device(phone).

In a document I was dropping during these months my UI Wishlist

There is a mockup of the future InquiryPanel which I would like to receive some feedback too, but the intention of the post is to show the current Preference application:

3 tabs, rightmost is pretended for global settings. The middle one, pretends to be a list of all known remote device: reacheable, paired, blocked, connected. And a description of what we know about it or services offered if available.

And the target of the post would be the tab which can be seen in the screenshot. Is the description of the LocalDevice, and the most basic action make it enter the game(discoverable). The good thing of those 2 checkboxes is that they are actually working. The black box is intended to show a laptop or Desktop machine(who know.. a smartphone?) icon depending how are you willing to identify yourself.

The panel is very basic so I thought there are many artists around that might want to give me some ideas with mockups or comments. I would be glad reading them before going on with the code.

BTW: The dongle identified in the screenshot is one donated by Pieter Panman one finally containing a valid bdaddr, thanks!

lunes, 24 de noviembre de 2008

5th/6th Milestone, Phase 1 reached.

It has been since our first Google Summer of Code, back in spring 2007, that I wanted to write this post.

After achieving l2cap signalling communication in both ways, the test was to force the mobile phone to initiate any kind of communication with Haiku. Concretelly it was a SDP(service discovery protocol) session, in which the mobile asks Haiku, about which bluetooth services is Haiku providing.

There are some signals that needed to be replied and some issued by our side, after getting the first portion of data that actually belongs to the next upper protocol(SDP in this case).

Here in the kernel syslog we can see some traces:



Basically these 2 lines with HEX data, is the SDP packet traced at l2cap Layer. The packet is fragmented in 2 ACL frames so somehow the ACL segmentation could be tested here.  Eventually the target was to drop this packet, to an application that was creating a L2cap socket with the SDP psm(protocol service multiplexer).

So a small application was created faking a SDP server(mobile was acting as a SDP client) creating a l2cap socket listening in the SDP psm(similar to tcp/ip ports) and here we could see the first read of that app:




My mobile was actually freaking out not receiving any SDP response after all the successful pairing and the l2cap signalling configuration. Having many times to remove the Battery, or wait around 10 minutes to expire all connections.

So thats all for the moment. The  proposal document  is updated. In another post I will comment about what is my plan post-Phase1/Arce.

Thanks to all for support, but... there is still more to come:)

lunes, 17 de noviembre de 2008

L2cap Signaling / 2 ways

Already passed one month. Was expecting to be back at starting the month, but amazingly was sent again again last week.

The responsed l2cap signals Haiku was sending to the test mobile phone where a bit malformed. Wrong size in the ACL and L2cap fields and a misunderstanding the source and destination Channel ID.

After some KDL's and playing with the layers interconnection, the remote device understood my l2cap response signal and the phone replied requesting to initiate a configuration session....

near near...

martes, 14 de octubre de 2008

1 month shift (Sorry)

As some of you know the Bluetooth bounty had 1st November as Deadline.

We are still behind schedule and the status prevision given the last week progress is that the next milestone could be reached in the following 2 weeks(counting this one).

So we had 1 week free as security, but seems is not gonna be enough, I was expecting a business trip sooner or later, and it arrived NOW which will keep me occupied the rest of the month.

I am gonna be in a German Town/City called Kronach somewhere around Munich according to the flight my company booked. It is really a pity that I dont have any development env setup in a laptop because it is gonna be boring, as I dont really know much people around...

Therefore I am forced to shift the bounty 1 month, sorry.

martes, 7 de octubre de 2008

L2cap signalling / 1 way

The testing of all the l2cap lower layer has started.

After pairing, we are ready to receive ACL packets, that after reassembling them, become L2cap frames, which the ones of type G, are already user/application data.

But first of all are the C type frames (signals), which will establish a L2cap Channel, this channel will be the carrier of  those G type frames.

So after theory the facts: the ACL data is reassembled(not well tested as the first L2CAP frame I got could be fitted in 1 ACL packet :-/) and forwarded to L2CAP layer parsing it and handling the first L2cap C Frame, which is the major achievement these last days.

This first signal requests us to open a channel, so the next step is to check whether there is a l2cap bound socket for accepting it and replying with another signal frame, which will need to be segmented(if big enough) and sent as ACL...

miércoles, 24 de septiembre de 2008

Bluetooth update & Hardware donation

It has been a long time without any update on the bluetooth Stack.

During these 2 months all the activity has been centered in implementing the L2cap protocol (and of course, going to the beach). The analog protocol in a TCP/IP Stack would be the TCP and UDP protocol, So it is not a trivial task.

The good point in all this is that after having some license conversation with the main FreeBSD developer(Maksim Yevmenkin) and the Haiku developers maillist, I am reusing some BSD code adapted to the Haiku kernel API, which is saving a lot of development time.

I divided the l2cap protocol in 2 sublayers (lower/higher). The whole lower is finished and currently I am completting the higher, which will merge with the final sockets interface accomplishing the last milestone.(FINALLY!)

By other hand Ineed to thank another hardware donation from......


With a huge delay thanking him, Luroh sent me a couple of bluetooth PCMCIA cards and one Wireless. When I got them I was almost ready to stop the development of the stack to code the transport drivers for those  cards, but Haiku hasnt PCMCIA support :(... so something more in my TODO-list. But anyway the cards will be useful as they duplicate the number of bluetooth devices I own.

 Thanks Luroh!

miércoles, 23 de julio de 2008

Pairing! 4th milestone


Yes, another of my fuzzy and unreadeable pics. The camera just run out of batery this time and could not get a better pic.

Remember about Mavin? this time it is added(if readeable) in the Trusted devices list of my phone after passing through a parinig process, typing pincodes and exchanging an encryption key.

In the screenshot can be seen the pincode window for the user(to type the pincode that has to match the phone typed one) and another litte window which is meant to inform that the pairing Connection has been successful.

This time I have to thank Monni that has been sending me patches with some code supporting part of the pairing process :)

lunes, 28 de abril de 2008

Haiku Bluetooth Stack Release

I promised Andrea a Xmas gift and I have already delayed it enough. So let's zip all we showed in the last posts and give some instructions on how to deal with it. Now the kit has some functionality implemented so it makes more sense a release for people that wants to play a bit with it, As some application as a Preference could be actually written.

Before proceeding please, read this other article about the possible risks.

[инструкция на русском]
[Auf Deutsch]
Installation steps for R5(not tested under Haiku or ZETA):

Install the driver (/h2/h2generic) :

Place the driver in:
/boot/home/config/add-ons/kernel/drivers/bin

And make a link to it, placing it in:
/boot/home/config/add-ons/kernel/drivers/dev/bluetooth

Most likely you dont have the folder, just create it. Ensure your dongle is recognized by the USB stack. Use usb_dev_info command. After this, make sure the device is published correctly by:

$ find /dev/bluetooth/
/dev/bluetooth/
/dev/bluetooth/h2generic
/dev/bluetooth/h2generic/0

If not, a restart or $ rescan h2generic might help.


Intall the library (/lib/libbluetooth.so) :


Place the lib in :
/boot/home/config/lib/

Run the bluetooth_server (/server/bluetooth_server) :

You can place this component in any place.
E.G: /boot/beos/system/servers/

Run any of the provided apps (/apps/*) :

These are command line applications. You can place this component in any place, just ensure you run them from terminal to see the results

Functionlity available:

    Everything used by command lines applications under:
/haiku/trunk/src/bt_*.cpp

    LocalDevice::SetDiscovery();
Which is not used by any of the applications in point 1


Download Bluetooth for Haiku (Arce.4.1)


note: If anybody creates any nice script or "Drop me here link folders", with pleasure, I will publish it here.

sábado, 19 de abril de 2008

Milestone 3, Discovering Remote devices

Being discovered was the second milestone, but the capability of discovering another device (a bit more complicated) is what I had proposed as the third milestone.

Some may have seen the commits, all methods to perform a basic inquiry process are implemented. So nothing more, I have just got all mobile phones with bluetooth capabilities around at home:



Activated its visibility, and:



At the end you can see the names of the 3 phones and its addresses :)


As note I could not make the WiiMote getting discovered, I guess it has to be handled some other way...

miércoles, 9 de abril de 2008

First post for a new writer


Hello !

I am Adrien Destugues ("PulkoMandy"), and this year I am willing to participate into Google Summer of Code for Haiku. One of my projects proposals is writing a preference application for the bluetooth stack.

I started by adding the stack to the default haiku.image to test it under Haiku, and it seems to be working well. I tested everything under qemu so I was just able to check if the program runs... can't connect to a bluetooth dongle from inside qemu.

Next step is getting haiku to boot on real hardware and with a bluetooth dongle attached to it...

Here is a picture of the bluetooth stack running under haiku :). Nothing very exceptional, but it's a good start to build the prefs window around it :)

jueves, 6 de marzo de 2008

Milestone 2, circle closed

The circle | driver - bluetooth_server - bluetooth kit - application | has been closed. Quite long ago I showed how the driver was replying to some request, which is more or less what I can show in the following screenshot. But that was accessing directily to the driver sending raw data and dropping to the screen any reply from it.

What we have here is an app(bt_dev_info) that uses an API defined by the bluetooth kit (libbluetooth.so). The kit is keeping a BMessaged comunication with the bluetooth_server requesting information and waiting for a reply. The bluetooth_server is the one keeping track of all the bluetooth devices we have connected in our system and is the only one who will perfom the real hardware requests to the driver(h2generic) issuing a HCI command to the driver. The driver replies with a given HCI event to the server, the server searches who was actually waiting for the reply information, releasing the data back to the kit again, so the application gets the needed info.

All a huge background that is not bringing us new spectacular things. But its the skeleton and the base of all the Haiku bluetooth subsystem. From now on, new bluetooth functionalities are some lines of code far
(in HCI layer terms).

A BMessenged HCI layer implemented totally in userland which Linux or FreeBSD has in kernel land(almost all) Lets see how it goes with us.






domingo, 10 de febrero de 2008

Second Testing stage

These were the first evidences that bluetooth could actually work in Haiku , that was the result of a first code testing after the coding of the driver. Now finally I could compile the three entities which are to compose the young haiku bluetooth stack:

H2 Transport(Hardware independency):

$HAIKU/system/add-ons/kernel/drivers/bluetooth/h2/h2generic

Partial HCI Layer(Network establishment and handling):

$HAIKU/system/servers/bluetoth_server

UserLand kit interaction(Bluetooth Kit):
$HAIKU/system/lib/libbluetooth.so


At the first run the server runs in Haiku without crashing for the moment, so lets see how all this parts get on well together... test again...


martes, 5 de febrero de 2008

BT Boosted

Some weeks ago I requested in haikuware about the possibility of someone having any old RAM simms for a Pentium 2 or 3.

Since my AMD literally burnt, I was dealing with 128MB RAM pentium 3 for the development, and the build process was often failing due lack of memory. Moreover, the heater was not really doing a good job... as the CPU temperature was around 60ºC therefore I had to even underclock it, delaying all stuff. (Anyway I am the kind of persons using always old hardware)

But today I got a nice packet from Canada !!! two 128 RAM sims which I inmediatelly plugged:



64+64+128+128 And now even its possible to use actually the system while buidling!
no need anymore to kill even the debug_server for saving memory:D




THANKS DENNIS(theNerd)

To update a bit the status of the bluetooth project: The USB tranport driver Driver and kit are currently comitted & building in the Haiku the svn and currently I am tailoring the bluetooth server, expecting commiting and the end of the week for starting the test of the whole system.



lunes, 14 de enero de 2008

End Xmas

No escuse, end of christmas.. even that we end at 6th Jan regarding the kings day, nor the orthodox which ends on 7th.
Something to test will need to wait at least 1 month more, Although most of the code is there I still could not have time to join it and test it...

here is the screenshot of the debugging tool... nothing impressive...


miércoles, 26 de diciembre de 2007

Xmas Xmas...

Another couple of days far from home... South this time, in Sevilla. I had some portions of code in the different places I am staying, some parts of the bluetooth kit in that computer, the server in a another.

A bit in a rush, before departing, gathered them all together in an old laptop with the hope i get some "free familiar time" to merge all them together, being able to test as soon as I come back home, and make a release with all work untill now at the end of Xmas time.

I got again from the opensourced BeNet an usefull class to handle debug information without having to trick logfiles... Which would be the first screenshot I could show of all the bluetooth system with some visual UI stuff. Later later...

As I promised to Andrea;) to give him a toy for Xmas to test...

Best Wishes to all!