How to check if Bluetooth device is UP or NOT using l2ping ?

If you want to know the bluetooth device you want to connect to is alive or not, i.e. whether that device’s bluetooth is ON or not and wheter it can respond to our other request like enquiry for information etc.

For this l2ping helps us. L2ping sends a L2CAP echo request to the Bluetooth MAC address bd_addr given in dotted hex notation.

For the very first time, we need to know the BT_ADDR or BT MAC of the device whose status we want to check. We can know the BT MAC using following command,

$ sudo hcitool scan
Scanning ...
	6C:C4:D5:6C:C5:BC	Nokia 7 plus

Now, lets see if the device is UP or NOT, this command is very similar to network ping.

$ sudo l2ping 6C:C4:D5:6C:C5:BC
Ping: 6C:C4:D5:6C:C5:BC from 70:1A:04:59:69:04 (data size 44) ...
44 bytes from 6C:C4:D5:6C:C5:BC id 0 time 5.93ms
44 bytes from 6C:C4:D5:6C:C5:BC id 1 time 8.76ms

Now, lets see how the command responds when the Bluetooth of

 $ sudo l2ping 6C:C4:D5:6C:C5:BC
Can't connect: Host is down
Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply