DEBIAN: how to pair a bluetooth printer on console

0

So the status is this:

1) The USB Bluetooth Dongle is inserted, and recognized.

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) I installed the following packages from buster without incidents:

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) bluetooth is not blocked:

root@server:~# rfkill list
0: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

4) bluetooth service is running:

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

I have no access to X, so I cannot run blueman

How can I now make the device visible and start the pairing process with the printer just from console, in order to install the printer on this computer?

UPDATE1: Finally I was able to see the printer with

root@server~# bluetoothctl
Agent registered

okay.

[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

ok, so I went like this:

[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]#

and then I started:

[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]#

then I go

[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

and after some seconds ...

[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]#

The printer device has something called Smart Bluetooth so I said to myself maybe I must not "pair" but "trust" so i went:

[bluetooth]# trust 06:0E:3C:5C:1A:FD
Changing 06:0E:3C:5C:1A:FD trust succeeded
[bluetooth]#

and so I stuck again I still can not see the printer on http://127.0.0.1:631

Any hint ?

console
printer
bluetooth
asked on Server Fault Mar 19, 2020 by Max Muster • edited Mar 19, 2020 by Max Muster

1 Answer

0

After some hours I found the answer.
first you must disable the enable/disable the simple pairing mode. depending on what your device is supporting. I do not need it so I disabled it.

hciconfig sspmode off

The next I disabled the timeout, because I want the printer to stay connected until I disconnect him. in /etc/bluetooth/input.conf

IdleTimeout=30

Just change it to 0 and the devices stay connected.

IdleTimeout=0

Case solved.

answered on Server Fault Mar 19, 2020 by Max Muster • edited Mar 19, 2020 by Max Muster

User contributions licensed under CC BY-SA 3.0