블루투스 헤드폰을 좌석에 연결하기 위한 udev 규칙

블루투스 헤드폰을 좌석에 연결하기 위한 udev 규칙

다중 좌석 설정을 사용하고 있는데 loginctlBluetooth 헤드폰을 사용하는 데 문제가 있습니다.

USB Bluetooth 어댑터가 켜지지만 재부팅 시 seat0모니터 번호가 :N무작위로 변경되고 헤드셋이 마지막으로 연결되었던 모니터 번호에 연결되거나 seat0다른 활성 좌석이 없는 경우 연결됩니다.

헤드폰을 나에게 연결해 주세요...

❯ sudo udevadm -d monitor -p
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[11828.639536] add      /devices/pci0000:00/0000:00:05.0/0000:06:00.0/usb8/8-2/8-2:1.0/bluetooth/hci0/hci0:12 (bluetooth)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:05.0/0000:06:00.0/usb8/8-2/8-2:1.0/bluetooth/hci0/hci0:12
SUBSYSTEM=bluetooth
DEVTYPE=link
SEQNUM=5747

UDEV  [11828.643688] add      /devices/pci0000:00/0000:00:05.0/0000:06:00.0/usb8/8-2/8-2:1.0/bluetooth/hci0/hci0:12 (bluetooth)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:05.0/0000:06:00.0/usb8/8-2/8-2:1.0/bluetooth/hci0/hci0:12
SUBSYSTEM=bluetooth
DEVTYPE=link
SEQNUM=5747
USEC_INITIALIZED=11828643524
SYSTEMD_ALIAS=/sys/subsystem/bluetooth/devices/hci0:12
SYSTEMD_WANTS=bluetooth.target
SYSTEMD_USER_WANTS=bluetooth.target
TAGS=:systemd:
CURRENT_TAGS=:systemd:

KERNEL[11830.906947] add      /devices/virtual/input/input74 (input)
ACTION=add
DEVPATH=/devices/virtual/input/input74
SUBSYSTEM=input
PRODUCT=5/0/0/0
NAME="NC-25 (AVRCP)"
PHYS="5c:f3:70:6a:03:6c"
PROP=0
EV=100007
KEY=2fc800 145200000000 0 10300 49e800000c00 e16800000000f f810000010000ffc
REL=0
MODALIAS=input:b0005v0000p0000e0000-e0,1,2,14,k71,72,73,8A,8B,A3,A5,A6,A7,A8,AB,AE,C8,C9,D0,161,164,166,16A,16C,18B,18E,18F,190,191,192,193,195,ramlsfw
SEQNUM=5748

KERNEL[11830.907167] add      /devices/virtual/input/input74/event265 (input)
ACTION=add
DEVPATH=/devices/virtual/input/input74/event265
SUBSYSTEM=input
DEVNAME=/dev/input/event265
SEQNUM=5749
MAJOR=13
MINOR=265

UDEV  [11831.445222] add      /devices/virtual/input/input74 (input)
ACTION=add
DEVPATH=/devices/virtual/input/input74
SUBSYSTEM=input
PRODUCT=5/0/0/0
NAME="NC-25 (AVRCP)"
PHYS="5c:f3:70:6a:03:6c"
PROP=0
EV=100007
KEY=2fc800 145200000000 0 10300 49e800000c00 e16800000000f f810000010000ffc
REL=0
MODALIAS=input:b0005v0000p0000e0000-e0,1,2,14,k71,72,73,8A,8B,A3,A5,A6,A7,A8,AB,AE,C8,C9,D0,161,164,166,16A,16C,18B,18E,18F,190,191,192,193,195,ramlsfw
SEQNUM=5748
USEC_INITIALIZED=11830908664
ID_INPUT=1
ID_INPUT_KEY=1
ID_BUS=bluetooth
TAGS=:seat:
CURRENT_TAGS=:seat:

UDEV  [11832.553850] add      /devices/virtual/input/input74/event265 (input)
ACTION=add
DEVPATH=/devices/virtual/input/input74/event265
SUBSYSTEM=input
DEVNAME=/dev/input/event265
SEQNUM=5749
USEC_INITIALIZED=11831463188
ID_INPUT=1
ID_INPUT_KEY=1
ID_BUS=bluetooth
LIBINPUT_DEVICE_GROUP=5/0/0:5c:f3:70:6a:03:6c
MAJOR=13
MINOR=265
TAGS=:power-switch:
CURRENT_TAGS=:power-switch:

loginctl특정 장치를 특정 좌석에 연결하는 udev 규칙을 생성했지만 블루투스 장치가 전혀 표시되지 않고 loginctl seat-status seat0블루투스 어댑터만 표시되지만 기본적으로 켜져 있습니다 seat0. Bluetooth 헤드셋과 일치하는 사운드 장치가 없습니다.

❯ loginctl seat-status seat0 | grep sound
                  ├─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3
                  │ sound:card3 "HDMI_1"
                  │ ├─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3/input27
                  │ ├─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3/input28
                  │ ├─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3/input29
                  │ ├─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3/input30
                  │ └─/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card3/input31
                  ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2
                  │ sound:card2 "SB"
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input40
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input41
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input42
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input43
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input44
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input45
                  │ ├─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input46
                  │ └─/sys/devices/pci0000:00/0000:00:14.2/sound/card2/input47

loginctl블루투스 헤드셋이 항상 바인딩되도록 udev에서 만든 것과 유사한 규칙을 작성할 수 있습니까 seat0?

❯ cat /etc/udev/rules.d/72-seat-sound-pci-0000_04_00_1.rules
TAG=="seat", ENV{ID_FOR_SEAT}=="sound-pci-0000_04_00_1", ENV{ID_SEAT}="seat1"

관련 정보