On Thu, Dec 25, 2025 at 1:41 AM hlyg <[email protected]> wrote:

> i want to transfer files between bookworm and android 10 via bluetooth
>
> i have tested bluetooth with blueman of bookworm, it works, it can
> connect to hot spot of cell phone via bluetooth
>
> but how to transfer files? i see menu item "send file" in blueman, how
> to use it?
>
Preparation

Install
<https://wiki.debian.org/PackageManagement#Installing.2C_removing.2C_upgrading_software>
Bluetooth
support (package bluetooth <https://packages.debian.org/bluetooth>) :

Read /usr/share/doc/bluez/README.Debian.gz to get some understanding of
what's going on.

Make sure the Bluetooth daemon is running. If it's not running, start it.

# service bluetooth statusbluetooth is running

# service bluetooth start


Firmware

If your hardware supports Bluetooth but Debian is unable to find any
Bluetooth devices, you may need to install extra Firmware
<https://wiki.debian.org/Firmware> packages.

Add a non-free-firmware for Debian 12 bookworm and newer or a non-free
component
for older releases to your apt sources
<https://wiki.debian.org/SourcesList> and
install

   -

   bluez-firmware <https://packages.debian.org/bluez-firmware> package for
   dongles based on the Broadcom BCM203x and Raspberry Pi chipset,
   -

   firmware-iwlwifi <https://packages.debian.org/firmware-iwlwifi> for
   Intel wireless cards.


Pairing

For security reasons, Bluetooth devices will only talk to each other if
they have been "introduced" first (a bit like in real life :-)). This is
referred to as Pairing <http://en.wikipedia.org/wiki/Bluetooth#Pairing>.

Note that pairing is usually only required the first time two devices
interact. Afterwards, they will remember each other, and no exchange of
PINs is necessary. This will however depend on the devices involved (on
some devices this may be configurable).

To pair devices, you need a *passkey-agent*. Options are:

Pairing using a GUI tool

Install
<https://wiki.debian.org/PackageManagement#Installing.2C_removing.2C_upgrading_software>
one
of the following packages:

   -

   gnome-bluetooth <https://packages.debian.org/gnome-bluetooth> (for GNOME)
   -

   bluedevil <https://wiki.debian.org/bluedevil> (for KDE)
   -

   or blueman <https://packages.debian.org/blueman> (Gtk2)

Log out of your desktop session and log back in - this is required for the
pairing pop-up in the next step to appear correctly.

On your Bluetooth device you can now try to pair. On the device you need to
choose something like the "setup", "connect" or "Bluetooth" menu and then
search for Bluetooth devices. You should find your Debian system, called
something like debian-0, where debian is the hostname of your Debian
system. On your device, select the Debian system. The device will then ask
for a PIN, you can make one up, (choose four digits, say *2309* ).

On your computer you will get a pop-up information balloon asking for the
PIN, something like Pairing request from Phone (xx:xx:xx:xx:xx:xx) where
Phone is the name of your phone and xx:xx:xx:xx:xx:xx is its MAC address.

Click on the information balloon.

Another window will pop-up. It asks for the PIN, enter the one you just
made up. (e.g. 2309 ) and press [Enter].

Your phone sees that the PIN matches and shows it on its display.

Both devices are now paired.

Pairing using CLI

If you do not want to or cannot use Gnome or KDE, you can also use
*bluetooth-agent* or *bluetoothctl* for the pairing.

Using bluetooth-agent

Bluetooth-agent is a part of package bluez
<https://packages.debian.org/bluez>, so it should already be available if
Bluetooth has been configured on your system.

Just start bluetooth-agent (as root), giving an arbitrary PIN, such as 4835:

# bluetooth-agent 4835

Then, as described above, choose something like the "setup", "connect" or
"Bluetooth" menu on the device to be paired, and search for Bluetooth
devices. Select your computer once found; the device should prompt you for
a PIN. Now enter the PIN you gave to bluetooth-agent, and pairing is
completed.

*Note:* Instead of initiating the pairing process from the phone, you can
also initiate it from the computer. Start *bluetooth-agent* as explained
above, then run a command that will try to connect to the phone, e.g.

rfcomm connect hci0 <phone address>

where <phone address> is your phone's bluetooth address, as shown by *hcitool
scan* (note that this will only work if the *phone* is discoverable, though
the computer need not be). This will force a connection from computer to
phone, which should cause the phone to ask you to confirm the connection
attempt by prompting for a PIN. Enter the pin you used with bluetooth-agent.

Using bluetoothctl

If bluetooth-agent is not available, try bluetoothctl:

Start the bluetoothctl interactive command. Enter "help" to get a list of
available commands.

   - Turn the power to the controller on by entering "power on". It is off
   by default.
   - Enter "devices" to get the MAC Address of the device with which to
   pair.
   - Enter device discovery mode with "scan on" command if device is not
   yet on the list.
   - Turn the agent on with "agent on".
   -

   Enter "pair *MAC Address*" to do the pairing (tab completion works).
   -

   If using a device without a PIN, one may need to manually trust the
   device before it can reconnect successfully. Enter "trust *MAC Address*"
   to do so.
   -

   Finally, use "connect *MAC address*" to establish a connection.

Troubleshooting

General pairing issues

In order for the pairing to work as described above, your computer's
bluetooth interfaces must be discoverable. A bluetooth dongle may start off
in hidden mode (bug report here
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=384379>)

To fix this you can run:

# dbus-send --system --dest=org.bluez /org/bluez/hci0
org.bluez.Adapter.SetMode string:discoverable

Or using *hciconfig*:

# hciconfig hci0 piscan

Then *hciconfig* should show the flags *ISCAN PSCAN*, indicating bluetooth
is discoverable (i.e. can be scanned). After you finished pairing, it's
best to make your computer hidden again:

# dbus-send --system --dest=org.bluez /org/bluez/hci0
org.bluez.Adapter.SetMode string:off

Or using *hciconfig*:

# hciconfig hci0 noscan

-- 

With kindest regards, William.

*Larry Wall invented a messy programming language -- and changed the face
of the Web*

Reply via email to