linux下使用蓝牙设备

本文档详细介绍了在Ubuntu系统中如何加载蓝牙模块、重启蓝牙服务、绑定TTY设备、激活蓝牙、查看设备信息、搜索周边蓝牙设备、建立虚拟串口、配置SDP协议通道、绑定及连接蓝牙设备。通过一系列步骤,包括使用bluez工具和脚本来实现蓝牙的配置和管理,适用于系统管理员和开发者进行蓝牙设备的调试和应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UBUNTU下面有个gnome蓝牙桌面管理器,使用起来很简单,但是搞不清除这个工具的工作细节,看看下面的方法,用的是bluez提供的工具,写成的脚本,我好好研究研究,以备做嵌入式之用。

 

 

1 加载蓝牙模块
     需要加载的模块有bluetooth
hci_uart l2cap rfcomm sco bnep ,位于/lib/modules/`uname-r`/kernel/net/bluetooth 和/lib/modules/`uname -r`/kernel/driver/bluetooth
注:可以使用 bt_ins.sh 与 bt_rm.sh 两个脚本,进行蓝牙模块的添加与删除

#!/bin/bash
#name: bt_in.sh
#author:young
#date: 2007-01-16
#decription: insmod for bt modules
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/bluetooth.ko
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/l2cap.ko
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/sco.ko
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/bnep/bnep.ko
insmod /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/rfcomm.ko
insmod /lib/modules/`uname -r`/kernel/drivers/bluetooth/hci_uart.ko
lsmod | grep bluetooth


#!/bin/bash
#name: bt_rm.sh
#author:young
#date: 2007-01-16
#description: rmmod bt modules from kernel
rmmod hci_uart
rmmod bnep
rmmod sco
rmmod rfcomm
rmmod l2cap
rmmod bluetooth
lsmod


2 重启Bluetooth

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值