Joypadで簡易操作を試みる

LinuxBoxで文章を読むのにJoypadで操作できないかなと思ってちょっと試してみました.

はじめはxevコマンドでJoypadのKeyCodeを調べてxmodmadコマンドで書き換えればいいだろうと思っていたのですが,xevコマンドでJoypadは反応しないようでした.他に方法はないかと検索するとjoy2keyというものを見つけたのでこれを試してみました.

$ apt show joy2key
Package: joy2key
Version: 1.6.3-2
Priority: optional
Section: x11
Maintainer: Debian QA Group <packages@qa.debian.org>
Installed-Size: 52.2 kB
Depends: libc6 (>= 2.15), libx11-6
Homepage: http://joy2key.sourceforge.net
Tag: hardware::input:joystick, hardware::input:keyboard, implemented-in::c,
 role::program, use::configuring
Download-Size: 21.8 kB
APT-Sources: http://dennou-q.gfd-dennou.org/debian sid/main amd64 Packages
Description: ジョイスティックの動きを同等のキーストロークに変換
 joy2key により、ジョイスティックの軸とボタンの動きに対してキーボードイベント
 を選択できますので、ネーティブでジョイスティックをサポートしていないアプリケーション
 でジョイスティックやゲームパッドを利用できます。

DebianだとWheezy以降,Ubuntuだとprecise(12.04LTS)以降にパッケージがあるようです.

今回はDebian sidやjessieなので導入はパッケージを入れるだけでした.

$ sudo apt install joy2key

設定はよく解らなかったけどこの辺を参考に

こんな感じで動きました.キーマップは未だ詰めるつもりだけどとりあえず.

$ DISPLAY=:0 joy2key -X -buttons A B X Y L Tab Escape Return KP_9 -axis Left Right Up Down -thresh -16383 16383 -16383 16383

キーコードについてはxevや/usr/include/X11/keysymdef.hで確認できます.とりあえずここにも貼っておきます.

しかしShift + Tabも使いたいのだけどShift/Tabそれぞれ単体は入力できるけど同時入力が効かないようです.通常のKBDでは動作するのでjoy2keyの問題だと思います.

試した環境はDebian sidのjoy2key 1.6.3-2とDebian lennyのjoy2key 1.6.3-2でJoypadはハードオフで\200くらいだったBUFFALOのスーパーファミコンみたいな見た目のBSGP801シリーズと書かれているもの.

[ 5239.625574] usb 2-1.2: authorized to connect
[ 5263.982357] usb 1-1.2: new low-speed USB device number 6 using ehci-pci
[ 5264.095408] usb 1-1.2: New USB device found, idVendor=0583, idProduct=2060
[ 5264.095410] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 5264.095411] usb 1-1.2: Product: USB,2-axis 8-button gamepad  
[ 5264.095545] usb 1-1.2: Device is not authorized for usage
[ 5266.168066] usb 1-1.2: authorized to connect
[ 5266.176105] hidraw: raw HID events driver (C) Jiri Kosina
[ 5266.184205] usbcore: registered new interface driver usbhid
[ 5266.184207] usbhid: USB HID core driver
[ 5266.188173] input: USB,2-axis 8-button gamepad   as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0583:2060.0001/input/input19
[ 5266.188377] hid-generic 0003:0583:2060.0001: input,hidraw0: USB HID v1.10 Joystick [USB,2-axis 8-button gamepad  ] on usb-0000:00:1a.0-1.2/input0

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)