내 TV에 Raspberry Pi 4가 연결되어 있습니다. USB 컨트롤러를 연결하면 CEC를 사용하여 TV를 켜고 TV 입력을 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"