3

When I connect a bluetooth device (e.g. a wiimote) to my machine and list all device units of systemd via systemctl list-units -t device, the device unit shows up as sys-subsystem-bluetooth-devices-hci0:ID.device.

Problem:

I want to bind a systemd service to a specific bluetooth device unit (e.g. wiimote). Thus, I will need an idea about the name. The ID differs on two Arch linux machines.

Questions:

  • Who assigns these device IDs to bluetooth systemd device units?
  • Is the ID static on one system and among system updates and thus is it safe binding services to that device unit, i.e., will this service only be triggered when connecting a bluetooth device of the same type?
  • Can I change/influence this ID?

Attempts:

I tried to change the ID with an udev rule following this description on the Arch wiki. Via udevadm info -a -p $(udevadm info -q path -n /dev/hidraw4 ) I got:

looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/bluetooth/hci0/hci0:256/0005:057E:0330.000C/hidraw/hidraw4':
KERNEL=="hidraw4"
SUBSYSTEM=="hidraw"
DRIVER==""

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/bluetooth/hci0/hci0:256/0005:057E:0330.000C':
KERNELS=="0005:057E:0330.000C"
SUBSYSTEMS=="hid"
DRIVERS=="wiimote"
ATTRS{country}=="00"
ATTRS{devtype}=="gen20"
ATTRS{extension}=="none"

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/bluetooth/hci0/hci0:256':
KERNELS=="hci0:256"
SUBSYSTEMS=="bluetooth"
DRIVERS==""

All KERNEL(S) entries are not the same over two systems. I thus tried to apply the udev rule:

SUBSYSTEMS=="hid", DRIVERS=="wiimote", TAG+="systemd", SYMLINK+="wii"

But that doesn't create any additional device unit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.