私のテレビにRaspberry Pi 4が接続されています。 USBコントローラを接続したら、CECを使用してテレビの電源を入れ、テレビの入力をPiに切り替えてから、Steam Linkを起動するスクリプトを実行したいと思います。スクリプトを直接実行すると機能しますが、コントローラに接続するとルールをトリガーできないようです。うん私がやったsudo udevadm control --reload
ここに私の作業スクリプトがあります。別の名前で保存してください。/usr/local/bin/autogame.sh
echo 'on 0.0.0.0' | cec-client -s -d 1
echo 'as' | cec-client -s -d 1
/usr/bin/steamlink
udevadm monitor --kernel --property --subsystem-match=usb
コントローラを実行して挿入した結果は次のとおりです。
monitor will print the received events for:
KERNEL - the kernel uevent
KERNEL[189783.367795] add /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2 (usb)
ACTION=add
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/012
DEVTYPE=usb_device
PRODUCT=e6f/213/100
TYPE=255/255/255
BUSNUM=001
DEVNUM=012
SEQNUM=1838
MAJOR=189
MINOR=11
KERNEL[189783.373779] add /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
ACTION=add
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=e6f/213/100
TYPE=255/255/255
INTERFACE=255/93/1
MODALIAS=usb:v0E6Fp0213d0100dcFFdscFFdpFFicFFisc5Dip01in00
SEQNUM=1839
KERNEL[189783.374744] bind /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
ACTION=bind
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0
SUBSYSTEM=usb
DEVTYPE=usb_interface
DRIVER=xpad
PRODUCT=e6f/213/100
TYPE=255/255/255
INTERFACE=255/93/1
MODALIAS=usb:v0E6Fp0213d0100dcFFdscFFdpFFicFFisc5Dip01in00
SEQNUM=1844
KERNEL[189783.375136] add /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1 (usb)
ACTION=add
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=e6f/213/100
TYPE=255/255/255
INTERFACE=255/93/3
MODALIAS=usb:v0E6Fp0213d0100dcFFdscFFdpFFicFFisc5Dip03in01
SEQNUM=1845
KERNEL[189783.375580] add /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.2 (usb)
ACTION=add
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.2
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=e6f/213/100
TYPE=255/255/255
INTERFACE=255/93/2
MODALIAS=usb:v0E6Fp0213d0100dcFFdscFFdpFFicFFisc5Dip02in02
SEQNUM=1846
KERNEL[189783.384551] add /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.3 (usb)
ACTION=add
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.3
SUBSYSTEM=usb
DEVTYPE=usb_interface
PRODUCT=e6f/213/100
TYPE=255/255/255
INTERFACE=255/253/19
MODALIAS=usb:v0E6Fp0213d0100dcFFdscFFdpFFicFFiscFDip13in03
SEQNUM=1847
KERNEL[189783.385026] bind /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2 (usb)
ACTION=bind
DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/001/012
DEVTYPE=usb_device
DRIVER=usb
PRODUCT=e6f/213/100
TYPE=255/255/255
BUSNUM=001
DEVNUM=012
SEQNUM=1848
MAJOR=189
MINOR=11
これは私がそれから得るものですudevadm info -ap /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2
looking at device '//devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2':
KERNEL=="1-1.2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="ff"
ATTR{quirks}=="0x0"
ATTR{bNumInterfaces}==" 4"
ATTR{bcdDevice}=="0100"
ATTR{bMaxPacketSize0}=="8"
ATTR{removable}=="unknown"
ATTR{bConfigurationValue}=="1"
ATTR{bDeviceClass}=="ff"
ATTR{urbnum}=="34"
ATTR{idVendor}=="0e6f"
ATTR{speed}=="12"
ATTR{version}==" 2.00"
ATTR{devspec}==" (null)"
ATTR{devnum}=="17"
ATTR{ltm_capable}=="no"
ATTR{bMaxPower}=="500mA"
ATTR{rx_lanes}=="1"
ATTR{serial}=="05F89012"
ATTR{devpath}=="1.2"
ATTR{authorized}=="1"
ATTR{busnum}=="1"
ATTR{manufacturer}=="Performance Designed Products"
ATTR{bmAttributes}=="a0"
ATTR{product}=="Afterglow Gamepad for Xbox 360"
ATTR{idProduct}=="0213"
ATTR{tx_lanes}=="1"
ATTR{avoid_reset_quirk}=="0"
ATTR{bNumConfigurations}=="1"
ATTR{maxchild}=="0"
ATTR{configuration}==""
ATTR{bDeviceProtocol}=="ff"
これは私が試したが成功しなかったルールです/etc/udev/rules.d/00-usb-autogame.rules
。 。
ACTION=="add", SUBSYSTEM=="usb", ENV{PRODUCT}=="e6f/213/100", RUN+="/usr/local/bin/autogame.sh"
ACTION=="add", SUBSYSTEM=="usb", PRODUCT=="e6f/213/100", RUN+="/usr/local/bin/autogame.sh"
ACTION=="add", SUBSYSTEM=="usb", ATTR{serial}=="05F89012", RUN+="/usr/local/bin/autogame.sh"
ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="Afterglow Gamepad for Xbox 360", RUN+="/usr/local/bin/autogame.sh"