Tuesday 6 December 2016

Checking availability of BLE in Linux

Most modern PCs have Bluetooth as part of their hardware. But not all of them are Bluetooth Low Energy enabled. I am going to describe a quick way to determine whether your Linux machine is BLE enabled or not. 
First thing to check is to see if the machine is Bluetooth enabled. To do so, follow this link.
After confirming that Bluetooth is there and is running, you are ready to enter into the world of BLE provided of course you're able to.
Open up a terminal and type the following command, assuming hci0 is your adaptor:

$ hciconfig hci0 lestates

This command will return one of two kind of output depending on whether BLE is present or not. If you get something like this:

Read LE supported states on hci0 returned status 1

Then this means that BLE is not present and this is not a limitation you can fix by tweaking software. You need to purchase a Bluetooth Low Energy adaptor and plug it in to your machine. 
On the spin side, if you see a list of states offered by your machine then that obviously mean BLE is good to go. The output may look something like:

Supported link layer states:
YES Non-connectable Advertising State
YES Scannable Advertising State
YES Connectable Advertising State
YES Directed Advertising State
YES Passive Scanning State
YES Active Scanning State
YES Initiating State/Connection State in Master Role
YES Connection State in the Slave Role
YES Non-connectable Advertising State and Passive Scanning State combination
YES Scannable Advertising State and Passive Scanning State combination
YES Connectable Advertising State and Passive Scanning State combination
YES Directed Advertising State and Passive Scanning State combination
YES Non-connectable Advertising State and Active Scanning State combination
YES Scannable Advertising State and Active Scanning State combination
YES Connectable Advertising State and Active Scanning State combination
YES Directed Advertising State and Active Scanning State combination
YES Non-connectable Advertising State and Initiating State combination
YES Scannable Advertising State and Initiating State combination
YES Non-connectable Advertising State and Master Role combination
YES Scannable Advertising State and Master Role combination
YES Non-connectable Advertising State and Slave Role combination
YES Scannable Advertising State and Slave Role combination
YES Passive Scanning State and Initiating State combination
YES Active Scanning State and Initiating State combination
YES Passive Scanning State and Master Role combination
YES Active Scanning State and Master Role combination
YES Passive Scanning State and Slave Role combination
YES Active Scanning State and Slave Role combination
YES Initiating State and Master Role combination/Master Role and Master Role combination

No comments:

Post a Comment