In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Bluetooth function in Linux system". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use Bluetooth function in Linux system.
First make sure that there is a Bluetooth-enabled device on the hardware, and then run the following command to drive to our Bluetooth device:
The code is as follows:
Lsusb
Run hciconfig and you can see:
As can be seen from the picture above, our Bluetooth device is hci0.
Run hcitool dev to see the hardware address of our Bluetooth device
Run hcitoo-- help to see more related commands
And then we activate it:
The code is as follows:
Sudo hciconfig hci0 up
Note that Bluetooth must be turned on before activation, or the following error will occur:
And then we started scanning:
The code is as follows:
Hcitool scan
As you can see, I found the Bluetooth of my phone.
Then we are going to start connecting, and the main command used in the connection phase is rfcomm:
Run rfcomm-- help to see usage
First, you need to bind the destination Bluetooth device:
The code is as follows:
Sudo rfcomm bind / dev/rfcomm0 E0:A6:70:8C:A3:02
Note: the address above is the hardware address of the destination Bluetooth device
And then we connect it:
The code is as follows:
Sudo cat > / dev/rfcomm0
This is the purpose of the Bluetooth host will pop up a dialog box asking for a pin code, enter any one, and then the host will pop up a dialog box, as long as the input is consistent with just now can pass the verification. Then we found that my phone had already shown the mark of a successful match.
After the pairing is completed, we need to delete the binding (otherwise we will prompt the device that the device is busy the next time we use it). The command is as follows:
The code is as follows:
Sudo rfcomm release / dev/rfcomm0
Using rfkill soft switch Bluetooth and Wireless function under Linux
Many computer systems include radio transmissions, including Wi-Fi, Bluetooth, and 3G devices. These devices consume power and are a waste of energy when they are not used.
RFKill is a subsystem of the Linux kernel that provides an interface in which radio transmissions in computer systems can be queried, activated, and deactivated. When the transfer is deactivated, it can be in a state that can be reactivated by the software (soft lock) or where the software cannot be reactivated (hard lock).
RFKill provides an application programming interface (API) for the kernel subsystem. The kernel driver is designed to enable RFKill to register the kernel with this API and includes methods to enable and disable the device. In addition, RFKill provides notifications that can be interpreted by the user program and a method for the user program to query the transmission status.
The RFKill interface is located at / dev/rfkill and contains the current state of all radio transmissions in the system. Each device registers the current RFKill status with sysfs. In addition, RFKill issues a uevents whenever the state changes in an RFKill-enabled device.
Rfkill is a command-line tool that you can use to query and change RFKill-enabled devices on your system. To get this tool, install the rfkill package.
If you can search the wireless network and enter the correct password but still cannot access it when you turn it on, rfkill may be blocking the access. It is a soft switch used to control the use of the wireless network and Bluetooth.
Use the command rfkill list to get a list of devices, each containing an index number associated with it, starting at 0.
The code is as follows:
Rfkill list
You can use this index number to have rfkill stop or use a device, for example:
The code is as follows:
Rfkill block 0
Deactivate the first RFKill-enabled device in the system.
You can also use rfkill to block certain types of devices, or all RFKill-enabled devices. For example:
The code is as follows:
Rfkill block wifi
Deactivate all Wi-Fi devices in the system. To deactivate all RFKill-enabled devices, run:
The code is as follows:
Rfkill block all
To reuse the device, run rfkill unblock. For a complete list of device categories that rfkill can deactivate, run rfkill help.
Thank you for your reading, the above is the content of "how to use Bluetooth function in Linux system". After the study of this article, I believe you have a deeper understanding of how to use Bluetooth function in Linux system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.