所以状态是这样的:
1) 插入并识别USB蓝牙适配器。
root@server:~# lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
2)我从 buster 安装了以下软件包,没有任何意外:
bluez amd64 5.50-1
bluetooth all 5.50-1
libical3 amd64 3.0.4-3
bluez-obexd amd64 5.50-1
bluez-tools amd64 2.0~20170911.0.7cb788c-2
rfkill amd64 2.33.1-0.1
3)蓝牙未被屏蔽:
root@server:~# rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
4)蓝牙服务正在运行:
root@server:~# service bluetooth start
root@server:~# service bluetooth status
? bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-03-19 12:42:35 CET; 1min 9s ago
Docs: man:bluetoothd(8)
Main PID: 29677 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4333)
Memory: 1.6M
CGroup: /system.slice/bluetooth.service
mq29677 /usr/lib/bluetooth/bluetoothd
我无法访问 X,所以我无法运行 blueman
我现在如何才能使设备可见并从控制台开始与打印机的配对过程,以便在这台计算机上安装打印机?
UPDATE1:最后我能够看到打印机
root@server~# bluetoothctl
Agent registered
好的。
[bluetooth]# help
Menu main:
Available commands:
-------------------
advertise Advertise Options Submenu
scan Scan Options Submenu
gatt Generic Attribute Submenu
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller
devices List available devices
paired-devices List paired devices
system-alias <name> Set controller alias
reset-alias Reset controller alias
power <on/off> Set controller power
pairable <on/off> Set controller pairable mode
discoverable <on/off> Set controller discoverable mode
agent <on/off/capability> Enable/disable agent with given capability
default-agent Set agent as the default one
advertise <on/off/type> Enable/disable advertising with given type
set-alias <alias> Set device alias
scan <on/off> Scan for devices
info [dev] Device information
pair [dev] Pair with device
trust [dev] Trust device
untrust [dev] Untrust device
block [dev] Block device
unblock [dev] Unblock device
remove <dev> Remove device
connect <dev> Connect device
disconnect [dev] Disconnect device
menu <name> Select submenu
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print evironment variables
好的,所以我这样做了:
[bluetooth]# show
Controller 00:15:83:F4:BA:F5 (public)
Name: server
Alias: server
Class: 0x00000104
Powered: yes
Discoverable: no
Pairable: yes
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0532
Discovering: no
[bluetooth]#
然后我开始:
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 00:15:83:F4:BA:F5 Discoverable: yes
[bluetooth]# devices
Device 06:0E:3C:5C:1A:FD ENVY 5000 series
[bluetooth]#
那我去
[bluetooth]# pair 06:0E:3C:5C:1A:FD
Attempting to pair with 06:0E:3C:5C:1A:FD
[CHG] Device 06:0E:3C:5C:1A:FD Connected: yes
[CHG] Device 06:0E:3C:5C:1A:FD Name: OfficeJet 5200 series
[CHG] Device 06:0E:3C:5C:1A:FD Alias: OfficeJet 5200 series
[CHG] Device 06:0E:3C:5C:1A:FD ServicesResolved: yes
几秒钟后……
[CHG] Device 06:0E:3C:5C:1A:FD ServicesResolved: no
[CHG] Device 06:0E:3C:5C:1A:FD Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled
[bluetooth]#
打印机设备有一种称为智能蓝牙的东西,所以我对自己说也许我不能“配对”而是“信任”,所以我去了:
[bluetooth]# trust 06:0E:3C:5C:1A:FD
Changing 06:0E:3C:5C:1A:FD trust succeeded
[bluetooth]#
所以我又卡住了,我仍然看不到打印机http://127.0.0.1:631
有什么提示吗?
答案1
几个小时后我找到了答案。
首先,您必须禁用启用/禁用简单配对模式。具体取决于您的设备支持什么。我不需要它,所以我禁用了它。
hciconfig sspmode off
接下来我禁用了超时,因为我想让打印机保持连接直到我断开连接。在 /etc/bluetooth/input.conf 中
IdleTimeout=30
只需将其更改为 0,设备即可保持连接。
IdleTimeout=0
案件告破。