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 Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question