20231114在HP笔记本的ubuntu20.04系统下向RealmeQ手机发送PDF文件
2023/11/14 14:11
手机:Realme Q
笔记本电脑:HP
https://item.jd.com/100012583174.html
惠普(HP)战66 三代AMD版 14英寸轻薄笔记本电脑(锐龙7nm 六核 R5-4500U 8G 256G 一年上门+意外 2年电池)
百度:ubuntu BT蓝牙扫描 传输
https://download.csdn.net/blog/column/10505902/125683989
Ubuntu蓝牙Bluetooth命令行连接发送文件完整流程
1.确保bluez已安装好
$sudo apt install bluez
2.查看当前蓝牙阻塞状态
$sudo rfkill list
如果上面阻塞状态为yes,表示蓝牙关闭,则需要unblock打开蓝牙:
$sudo rfkill unblock bluetooth
3.执行bluetoothctl
$bluetoothctl
4.扫描其他蓝牙设备
$scan on
5.配对指定的蓝牙设备
$pair AA:AA:xxxxxx
$trust dev_address
pair 58:85:e9:2e:52:2a
trust 58:85:e9:2e:52:2a
connect 58:85:e9:2e:52:2a
6.如果没有安装bluez-tools则需要安装
$sudo apt install bluez-tools
使用bt-obex发送文件:
$bt-obex -p [remote_mac] [file]
譬如:
$bt-obex -p F0:6B:CA:A2:C4:69 ~/xxx.pdf
bt-obex -p 58:85:e9:2e:52:2a ~/readme.pdf
命令行监听接收则可以先执行命令:
$bt-obex -s [path]
譬如:
$bt-obex -s ~/Downloads
RealmeQ手机相关截图:
参考资料:
百度:bluetoothctl connect pair
https://blog.csdn.net/qq_28877125/article/details/134130625
【RP-RV1126】配置一套简单的板级配置
https://www.python100.com/html/82170.html
Bluetoothctl全解析
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ uname -r
5.15.0-88-generic
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ sudo apt install bluez
[sudo] password for rootroot:
Reading package lists... Done
Building dependency tree
Reading state information... Done
bluez is already the newest version (5.53-0ubuntu3.6).
bluez set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 102 not upgraded.
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ sudo rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ bluetoothctl
Agent registered
[CHG] Device 48:B8:A6:3A:04:6D RSSI: -73
[CHG] Device 43:4C:5D:C5:0B:1F RSSI: -82
[CHG] Device 4C:E1:73:B8:8C:0F RSSI: -97
[CHG] Device 49:3C:99:18:0A:1B RSSI: -83
[CHG] Device 53:98:AF:96:B5:34 RSSI: -92
[CHG] Device 45:C9:70:CD:02:20 RSSI: -85
[CHG] Device 59:B2:26:FF:62:53 RSSI: -57
[CHG] Device 65:8F:BE:BC:26:29 RSSI: -89
[CHG] Device 98:DA:B0:07:6D:32 RSSI: -77
[NEW] Device 4E:EE:7C:E2:63:5D 4E-EE-7C-E2-63-5D
[CHG] Device 45:C9:70:CD:02:20 RSSI: -85
[CHG] Device 7A:1B:5D:D7:A2:FB RSSI: -87
[CHG] Device 52:BC:9A:84:72:0E RSSI: -93
[CHG] Device 53:98:AF:96:B5:34 RSSI: -90
[CHG] Device 49:3C:99:18:0A:1B RSSI: -88
[CHG] Device 54:28:76:FE:F0:88 RSSI: -86
[NEW] Device 6D:BB:E1:6C:93:CB 6D-BB-E1-6C-93-CB
[CHG] Device DC:F0:90:3F:BC:78 RSSI: -71
[CHG] Device 52:89:F4:C9:74:A7 RSSI: -74
[CHG] Device 52:89:F4:C9:74:A7 ManufacturerData Key: 0x004c
[CHG] Device 52:89:F4:C9:74:A7 ManufacturerData Value:
01 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 ......@.........
00 .
[CHG] Device 7A:1B:5D:D7:A2:FB RSSI: -97
[CHG] Device 90:E4:68:E2:FE:43 RSSI: -59
[CHG] Device 61:22:DF:10:F5:72 RSSI: -82
[CHG] Device 65:8F:BE:BC:26:29 RSSI: -89
[CHG] Device 24:8D:0C:DE:34:AB RSSI: -99
[CHG] Device 47:18:94:BC:80:8F RSSI: -93
[CHG] Device 4C:E1:73:B8:8C:0F RSSI: -96
[CHG] Device 5F:C0:39:33:B1:99 RSSI: -93
[CHG] Device 98:DA:B0:07:6D:32 RSSI: -72
[CHG] Device 36:7E:54:84:FD:F5 RSSI: -63
[CHG] Device 52:BC:9A:84:72:0E RSSI: -91
[CHG] Device 36:7E:54:84:FD:F5 RSSI: -61
[CHG] Device 43:72:FC:CA:8F:37 RSSI: -93
[CHG] Device 52:BC:9A:84:72:0E RSSI: -89
[CHG] Device 52:89:F4:C9:74:A7 RSSI: -79
[CHG] Device 52:89:F4:C9:74:A7 ManufacturerData Key: 0x004c
[CHG] Device 52:89:F4:C9:74:A7 ManufacturerData Value:
01 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 ......@.........
00 .
[CHG] Device 56:E8:2E:9D:A3:52 RSSI: -62
[CHG] Device 04:7F:0E:4B:F7:F4 RSSI: -83
[CHG] Device 49:3C:99:18:0A:1B RSSI: -89
[bluetooth]# pair 58:85:e9:2e:52:2a
Attempting to pair with 58:85:E9:2E:52:2A
Failed to pair: org.bluez.Error.AlreadyExists
[CHG] Device 6A:9C:5C:AC:BE:C6 RSSI: -71
[CHG] Device 78:4F:5F:A4:D0:7D RSSI: -84
[CHG] Device C8:76:25:6F:1E:36 RSSI: -75
[CHG] Device 34:5B:B4:1C:4A:48 RSSI: -95
[CHG] Device 1D:8F:FD:E3:96:99 RSSI: -64
[bluetooth]# trust 58:85:e9:2e:52:2a
Changing 58:85:E9:2E:52:2A trust succeeded
[CHG] Device 4A:92:48:B6:27:1F RSSI: -61
[CHG] Device 98:DA:B0:07:6D:32 RSSI: -70
[CHG] Device 9C:77:01:D3:8F:F2 RSSI: -80
[CHG] Device 9C:97:89:80:29:C1 RSSI: -90
[NEW] Device 42:61:52:B5:27:10 42-61-52-B5-27-10
[CHG] Device 50:58:94:C2:95:42 RSSI: -97
[CHG] Device 5B:80:5F:E4:B5:01 RSSI: -63
[CHG] Device 41:12:BF:5A:CF:50 RSSI: -90
[CHG] Device 11:4F:6E:39:E3:BE RSSI: -66
[bluetooth]# connect 58:85:e9:2e:52:2a
Attempting to connect to 58:85:e9:2e:52:2a
[CHG] Device 23:46:31:3B:23:62 RSSI: -89
[CHG] Device 66:66:11:EE:D5:FB RSSI: -88
[CHG] Device 9C:97:89:80:29:C1 RSSI: -90
[CHG] Device 1D:8F:FD:E3:96:99 RSSI: -67
[CHG] Device 5A:52:DD:82:B0:3B RSSI: -79
[CHG] Device 41:12:BF:5A:CF:50 RSSI: -86
[CHG] Device 71:A2:CF:F1:C4:35 RSSI: -87
[CHG] Device 90:E4:68:E2:FE:43 RSSI: -57
[CHG] Device 9C:97:89:80:29:C1 RSSI: -93
[CHG] Device 41:12:BF:5A:CF:50 RSSI: -85
[CHG] Device 3D:B5:F6:A6:A1:44 RSSI: -76
[CHG] Device 3D:B5:F6:A6:A1:44 ManufacturerData Key: 0x004c
[CHG] Device 3D:B5:F6:A6:A1:44 ManufacturerData Value:
13 07 02 07 77 fa 26 70 6b ....w.&pk
[CHG] Device 90:E4:68:E2:FE:43 RSSI: -56
[CHG] Device 4A:92:48:B6:27:1F RSSI: -76
[CHG] Device 9C:97:89:80:29:C1 RSSI: -94
[CHG] Device 7F:F4:25:34:0C:F8 RSSI: -75
[CHG] Device 11:4F:6E:39:E3:BE RSSI: -71
[CHG] Device 67:46:4A:79:15:04 RSSI: -93
[CHG] Device 90:E4:68:E2:FE:43 RSSI: -56
[NEW] Device 71:B0:FA:94:A7:2A 71-B0-FA-94-A7-2A
[CHG] Device 48:8B:F9:30:5F:64 RSSI: -91
[CHG] Device 5B:80:5F:E4:B5:01 RSSI: -74
[CHG] Device 4A:92:48:B6:27:1F RSSI: -76
[CHG] Device 52:23:C7:0A:67:1E RSSI: -53
[CHG] Device 5A:52:DD:82:B0:3B RSSI: -76
[CHG] Device 67:46:4A:79:15:04 RSSI: -80
[CHG] Device 11:4F:6E:39:E3:BE RSSI: -66
[CHG] Device 3D:B5:F6:A6:A1:44 RSSI: -77
[CHG] Device 52:5D:B9:9D:B6:33 RSSI: -80
[CHG] Device 5E:2C:7B:1A:25:51 RSSI: -94
[CHG] Device 5B:80:5F:E4:B5:01 RSSI: -71
[CHG] Device 41:12:BF:5A:CF:50 RSSI: -82
[CHG] Device 64:1D:CD:1E:A4:12 RSSI: -67
[CHG] Device 24:01:0E:9B:AC:56 RSSI: -68
[CHG] Device 6A:15:10:B9:3D:87 RSSI: -72
[CHG] Device 4B:F3:ED:9B:02:46 RSSI: -78
[CHG] Device 6A:15:10:B9:3D:87 RSSI: -73
[CHG] Device 36:D5:15:8A:8C:57 RSSI: -95
[CHG] Device 90:E4:68:E2:FE:43 RSSI: -55
[CHG] Device 66:66:11:EE:D5:FB RSSI: -89
[CHG] Device 3D:B5:F6:A6:A1:44 RSSI: -72
[CHG] Device 23:46:31:3B:23:62 RSSI: -86
[CHG] Device 11:4F:6E:39:E3:BE RSSI: -66
[CHG] Device 24:01:0E:9B:AC:56 RSSI: -68
[CHG] Device 5B:2B:52:0A:A7:EA RSSI: -89
[CHG] Device 1D:8F:FD:E3:96:99 RSSI: -57
[CHG] Device 58:85:E9:2E:52:2A Connected: yes
[CHG] Device 7B:3C:96:A7:E7:3D RSSI: -75
[CHG] Device E8:D1:E2:C2:F9:7D RSSI: -96
[CHG] Device 64:1D:CD:1E:A4:12 RSSI: -75
[CHG] Device 23:46:31:3B:23:62 RSSI: -85
[CHG] Device 71:A2:CF:F1:C4:35 RSSI: -88
[CHG] Device 52:5D:B9:9D:B6:33 RSSI: -71
[CHG] Device 1D:8F:FD:E3:96:99 RSSI: -57
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ sudo apt install bluez-tools
[sudo] password for rootroot:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
bluez-tools
0 upgraded, 1 newly installed, 0 to remove and 102 not upgraded.
Need to get 153 kB of archives.
After this operation, 1,048 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 bluez-tools amd64 2.0~20170911.0.7cb788c-2build1 [153 kB]
Fetched 153 kB in 1s (104 kB/s)
Selecting previously unselected package bluez-tools.
(Reading database ... 213456 files and directories currently installed.)
Preparing to unpack .../bluez-tools_2.0~20170911.0.7cb788c-2build1_amd64.deb ...
Unpacking bluez-tools (2.0~20170911.0.7cb788c-2build1) ...
Setting up bluez-tools (2.0~20170911.0.7cb788c-2build1) ...
Processing triggers for man-db (2.9.1-1) ...
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ bt-obex -p 58:85:e9:2e:52:2a ~/readme.pdf
[Transfer#readme.pdf] Waiting...
[Transfer#readme.pdf] Progress: 100%
[Transfer#readme.pdf] Completed
(bt-obex:3062): GLib-CRITICAL **: 14:53:07.194: g_atomic_ref_count_dec: assertion 'g_atomic_int_get (arc) > 0' failed
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$