使用 /dev/input/js0 作为操纵杆绕过 MacBook Pro 的运动传感器

使用 /dev/input/js0 作为操纵杆绕过 MacBook Pro 的运动传感器

我使用的是 MacBook Pro 8,1,运行的是 14.04 版,我从未将任何带操纵杆的设备插入笔记本电脑。当我尝试修复输入问题时,我检查了一下,/dev/input/js0认为它不应该存在,但它确实存在。

我没有看到任何与操纵杆相关的内容xinput list

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ bcm5974                                   id=11   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ Apple Inc. Apple Internal Keyboard / Trackpad id=10   [slave  keyboard (3)]
    ↳ FaceTime HD Camera (Built-in)             id=12   [slave  keyboard (3)]
    ↳ Apple Computer, Inc. IR Receiver          id=13   [slave  keyboard (3)]

udevadm info /dev/input/js0显示:

P: /devices/platform/applesmc.768/input/input7/js0
N: input/js0
E: DEVNAME=/dev/input/js0
E: DEVPATH=/devices/platform/applesmc.768/input/input7/js0
E: ID_INPUT=1
E: ID_PATH=platform-applesmc.768
E: ID_PATH_TAG=platform-applesmc_768
E: MAJOR=13
E: MINOR=0
E: SUBSYSTEM=input
E: USEC_INITIALIZED=789104

udevadm info --attribute-walk /dev/input/js0显示:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/applesmc.768/input/input7/js0':
    KERNEL=="js0"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/applesmc.768/input/input7':
    KERNELS=="input7"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{max}=="50"
    ATTRS{min}=="0"
    ATTRS{name}=="applesmc"
    ATTRS{phys}==""
    ATTRS{poll}=="50"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/platform/applesmc.768':
    KERNELS=="applesmc.768"
    SUBSYSTEMS=="platform"
    DRIVERS=="applesmc"
    ATTRS{key_at_index_data}==""
    ATTRS{key_at_index_name}=="#KEY"
    ATTRS{key_at_index_type}=="ui32"
    ATTRS{name}=="applesmc"
    ATTRS{fan1_manual}=="0"
    ATTRS{temp12_input}=="59000"
    ATTRS{temp12_label}=="TCGC"
    ATTRS{temp3_input}=="34500"
    ATTRS{temp3_label}=="TB2T"
    ATTRS{fan1_output}=="6200"
    ATTRS{temp19_input}=="52000"
    ATTRS{temp19_label}=="TPCD"
    ATTRS{light}=="(0,0)"
    ATTRS{fan1_max}=="6200"
    ATTRS{fan1_min}=="6200"
    ATTRS{temp13_input}=="54000"
    ATTRS{temp13_label}=="TCSA"
    ATTRS{temp4_input}=="59000"
    ATTRS{temp4_label}=="TC0C"
    ATTRS{key_count}=="379"
    ATTRS{fan1_input}=="6313"
    ATTRS{fan1_label}=="Exhaust  "
    ATTRS{temp14_input}=="-250"
    ATTRS{temp14_label}=="TCTD"
    ATTRS{temp5_input}=="58500"
    ATTRS{temp5_label}=="TC0D"
    ATTRS{temp20_input}=="-127000"
    ATTRS{temp20_label}=="TW0P"
    ATTRS{key_at_index}=="0"
    ATTRS{position}=="(-8,-5,248)"
    ATTRS{key_at_index_data_length}=="4"
    ATTRS{temp15_input}=="42000"
    ATTRS{temp15_label}=="TM0P"
    ATTRS{temp6_input}=="59750"
    ATTRS{temp6_label}=="TC0E"
    ATTRS{temp21_input}=="40500"
    ATTRS{temp21_label}=="Th1H"
    ATTRS{calibrate}=="(1,8)"
    ATTRS{temp16_input}=="44500"
    ATTRS{temp16_label}=="TM0S"
    ATTRS{temp7_input}=="61000"
    ATTRS{temp7_label}=="TC0F"
    ATTRS{temp22_input}=="33000"
    ATTRS{temp22_label}=="Ts0P"
    ATTRS{temp10_input}=="60000"
    ATTRS{temp10_label}=="TC1C"
    ATTRS{temp1_input}=="35000"
    ATTRS{temp1_label}=="TB0T"
    ATTRS{temp17_input}=="0"
    ATTRS{temp17_label}=="TMBS"
    ATTRS{temp8_input}=="1000"
    ATTRS{temp8_label}=="TC0J"
    ATTRS{temp23_input}=="38500"
    ATTRS{temp23_label}=="Ts0S"
    ATTRS{temp11_input}=="59000"
    ATTRS{temp11_label}=="TC2C"
    ATTRS{temp2_input}=="35000"
    ATTRS{temp2_label}=="TB1T"
    ATTRS{temp18_input}=="44000"
    ATTRS{temp18_label}=="TP0P"
    ATTRS{temp9_input}=="54500"
    ATTRS{temp9_label}=="TC0P"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

我认识上面的温度传感器,这就是为什么我想知道为什么applesmc,会与操纵杆有关。假设我理解正确,这是因为applesmc使用 /dev/input/js0 作为 MacBook Pro 的运动传感器(我认为它们是用来检测它是否在水平表面上的传感器)。运动传感器在系统使用中有多重要?摆脱 安全吗?/dev/input/js0如果可以,如何安全地做到这一点?


我遇到的输入问题的背景是 Wine 上的 Skyrim。如果我在延迟峰值期间朝任何方向奔跑,我的角色就​​会卡在该方向奔跑,无论其他方向输入如何或角色是否处于自动运行状态。对于大多数人来说,解决这个问题的方法是禁用游戏手柄/操纵杆设置。我已通过游戏的设置和 .ini 文件禁用它,但问题仍然存在,这让我开始研究它是否与js0- 有关。

答案1

您必须使用 udev 将其列入黑名单。我首先去了这里:

https://github.com/denilsonsa/udev-joystick-blacklist

我想添加一个 Rumblepad。我的规则文件如下所示:

SUBSYSTEM=="input", ATTRS{name}=="applesmc", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}=""
SUBSYSTEM=="input", ATTRS{name}=="applesmc", KERNEL=="js[0-9]*", RUN+="/bin/rm %E{DEVNAME}", ENV{ID_INPUT_JOYSTICK}=""
SUBSYSTEM=="input", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1c26", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}=""
SUBSYSTEM=="input", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1c26", KERNEL=="js[0-9]*", RUN+="/bin/mv %E{DEVNAME} /dev/input/js0", ENV{ID_INPUT_JOYSTICK}=""

相关内容