$ git clone https://github.com/atar-axis/xpadneo.git $ cd xpadneo $ sudo ./install.sh # 如遇如下报错 # Your kernel headers for kernel 4.19.97-v7l+ cannot be found at # /lib/modules/4.19.97-v7l+/build or /lib/modules/4.19.97-v7l+/source. # 将 /lib/modules 下拷贝一份至缺失版本,如: # sudocp -r /lib/modules/5.4.79-v7l+ /lib/modules/4.19.97-v7l+
连接
1 2 3 4 5 6 7 8 9 10 11 12 13 14
$ bluetoothctl $ [bluetooth]# scan on ... # 长按xbox前侧配对键,至指示灯快速闪烁,出下如下新设备,记录其mac地址 [NEW] Device <MAC> Xbox Wireless Controller ... [bluetooth]# pairable on [bluetooth]# power on [bluetooth]# pair <MAC> [bluetooth]# trust <MAC> [bluetooth]# connect <MAC> # 如若报 Failed to connect: org.bluez.Error.Failed 错误,执行如下命令并重启系统 $ echo'options bluetooth disable_ertm=Y' | sudotee -a /etc/modprobe.d/bluetooth.conf
其他
1 2
# 查看设备 $ bluetoothctl devices
使用
Python
安装依赖
1
$ sudo pip3 install evdev asyncio
测试
1 2 3 4 5 6
$ cd xpadneo/misc/examples # 克隆下来的Git仓库 $ python3 python_asyncio_evdev/gamepad.py press x to stop, Y to rumble light, B to rumble once, trigger and joystick right to see analog value trigger_right = 32.98 joystick_right_x = 0 # 如果一切顺利,按手柄Y会感受到长震动;按B会感受到短震动;按X退出程序