Motion Joypad and linux PC

Post Reply
hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Motion Joypad and linux PC

Post by hanax »

I recently bought Motion Joypad - https://wiki.odroid.com/accessory/add-o ... ion_joypad.
I thought I will use it on regular PC with linux installed, but it seems it is designed only for Android and only for Odroid devices. But I think that in theory it may be possible to run it on PC, since this is USB device - I can see it with "lsusb".
Is there any chance this will somehow work? I've downloaded and compiled stuff from https://github.com/hardkernel/Odroid-USBIO, but it seems I need some python program to read data and then process them. Or is there some device driver that will act as an input device?
Sorry for my lack of understanding, any help will be appreciated. Thanks.

User avatar
odroid
Site Admin
Posts: 34947
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 960 times
Been thanked: 775 times
Contact:

Re: Motion Joypad and linux PC

Post by odroid »

Theoretically, it must work with a Linux PC as you mentioned.
But you need to port this device driver source codes into the PC Linux Kernel. You don't need to change the firmware in the Joypad controller CPU.
https://github.com/hardkernel/linux/com ... 755d6e56d3

We have not enough resources to implement it. Sorry about that.

hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Re: Motion Joypad and linux PC

Post by hanax »

OK I understand, thanks for the answer, I will try - maybe (with great deal of luck) I will be successful :)

hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Re: Motion Joypad and linux PC

Post by hanax »

Greetings, I managed to compile the driver from the git sources. It seems the driver is registered - I can see the dmesg output:

Code: Select all

[  252.393940] usbcore: registered new interface driver usbio
[  614.000176] usb 5-1.1.3: new full-speed USB device number 8 using xhci_hcd
[  614.160249] usb 5-1.1.3: New USB device found, idVendor=04d8, idProduct=003f, bcdDevice= 0.02
[  614.160251] usb 5-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  614.160252] usb 5-1.1.3: Manufacturer: ODROIDSensor
[  614.164912] hid-generic 0003:04D8:003F.000F: hiddev4,hidraw11: USB HID v1.11 Device [ODROIDSensor] on usb-0000:04:00.0-1.1.3/input0
However, now I am lost what to do next. I expected that I will see a new /dev/input/eventX based on the last paragraph on https://wiki.odroid.com/accessory/add-o ... ion_joypad, but that was not the case.
The input subsystem is a generic Linux framework for all input devices like keyboard, mouse, and touchscreen, which defines a standard set of events. It interfaces to the user space through the /sys/class/input interface.
The event device (Evdev) provides a generic way for input device events to be accessible under /dev/input/eventX. The sensor interface driver communicates with the USB IO Board via USB bus.
So the driver is not working or I am missing something. I will be very grateful for some additional guidance how to proceed. My goal is to use it as joystick/gamepad input device so it will be visible and usable by Linux games.
Thanks!

User avatar
odroid
Site Admin
Posts: 34947
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 960 times
Been thanked: 775 times
Contact:

Re: Motion Joypad and linux PC

Post by odroid »

My guidance must be very limited due to my insufficient knowledge.

What happens if you type cat /sys/class/input? or /sys/class/input0?
Did you add usbhid.quirks items in the Kernel paramter?
https://wiki.odroid.com/accessory/add-o ... tom_joypad
These users thanked the author odroid for the post:
hanax (Thu Jun 25, 2020 3:41 pm)

hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Re: Motion Joypad and linux PC

Post by hanax »

Many thanks for answer. Now it seems I am much closer to solution!

I added parameters to boot line as described in link.

Code: Select all

cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.3.0-59-generic root=UUID=e415b843-9667-46f4-8dcb-5abb15f06fd0 ro quiet splash acc_orientation=3 button_map=0:M:L,1:M:U,2:M:R,3:M:D,4:T:71:203,5:K:102,6:T:1214:212,7:T:1253:43,8:M:l,9:M:r usbhid.quirks=0x04d8:0x003f:0x0004 vt.handoff=1

Code: Select all

dmesg
[ 1538.241905] usbcore: registered new interface driver usbio
[ 1626.408384] usb 5-1.1.3: USB disconnect, device number 11
[ 1628.445514] usb 5-1.1.3: new full-speed USB device number 12 using xhci_hcd
[ 1628.605560] usb 5-1.1.3: New USB device found, idVendor=04d8, idProduct=003f, bcdDevice= 0.02
[ 1628.605561] usb 5-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1628.605562] usb 5-1.1.3: Manufacturer: ODROIDSensor
[ 1628.608137] input: ODROIDSensor as /devices/pci0000:00/0000:00:1c.5/0000:04:00.0/usb5/5-1/5-1.1/5-1.1.3/5-1.1.3:1.0/input/input62
[ 1628.608224] input: usbio-keypad as /devices/virtual/input/input63
[ 1628.608260] input: usbio-mouse as /devices/virtual/input/input64
Also I can see new devices /sys/class/input/js0 and /sys/class/input/mouse3. Great!
Moreover I can see ODROIDSensor input device in a game. Also great!

Unfortunately, it does not work :(. No fun in the game. I tried sudo cat /dev/input/js0 and sudo cat /dev/input/mouse3 while pressing buttons like crazy, but no output (besides some initial characters).

I feel I am so close, could you please give some more hints if you can?

User avatar
odroid
Site Admin
Posts: 34947
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 960 times
Been thanked: 775 times
Contact:

Re: Motion Joypad and linux PC

Post by odroid »

I ran out of ideas too. :(
How about trying "evtest" instread of "cat" command?

hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Re: Motion Joypad and linux PC

Post by hanax »

Thank you for the tip. I did not know about evtest. Surely it is much better tool:

Code: Select all

sudo evtest
...
/dev/input/event17:	ODROIDSensor
/dev/input/event18:	usbio-keypad
/dev/input/event19:	usbio-mouse
...
I tried them all:

Code: Select all

Select the device event number [0-256]: 17
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x4d8 product 0x3f version 0x2
Input device name: "ODROIDSensor"
Supported events:
  Event type 0 (EV_SYN)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min     -511
      Max      511
    Event code 1 (ABS_Y)
      Value      0
      Min     -511
      Max      511
    Event code 2 (ABS_Z)
      Value      0
      Min     -511
      Max      511
Properties:
Testing ... (interrupt to exit)

Code: Select all

Select the device event number [0-256]: 18
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x0 product 0x0 version 0x0
Input device name: "usbio-keypad"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event type 3 (EV_ABS)
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max       15
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     1280
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      720
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
Properties:
Testing ... (interrupt to exit)

Code: Select all

Select the device event number [0-256]: 19
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x0 product 0x0 version 0x0
Input device name: "usbio-mouse"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
Properties:
Testing ... (interrupt to exit)
However, nothing. It is playing dead. So I enabled debugging and now I see on dmesg:

Code: Select all

[ 1853.434268] usbio 3-9.4:1.0: usbio_irq - urb shutting down with status: -2
[ 1853.502178] usbio 3-9.4:1.0: usbio_irq - urb shutting down with status: -2
[ 1853.638153] usbio 3-9.4:1.0: usbio_irq - urb shutting down with status: -2
I can see this in code:

Code: Select all

static void usbio_irq (struct urb *urb)
{
...
 	switch (urb->status) {
	 	...
		case -EPIPE:
			/* this urb is terminated, clean up */
			dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, urb->status);
			return;
...
}
I found that it means "Stalled endpoint (-EPIPE)". I really have no idea what it is, but maybe you could please explain and help?
Many thanks!

hanax
Posts: 20
Joined: Sun Jun 21, 2020 2:28 am
languages_spoken: english
Has thanked: 5 times
Been thanked: 0
Contact:

Re: Motion Joypad and linux PC

Post by hanax »

OK, I gave up and returned the item. Maybe someone someday will have more luck / understanding, maybe it was only some unsuccessful excercise for me. Anyway, many thanks for support.

Post Reply

Return to “USB IO”

Who is online

Users browsing this forum: No registered users and 1 guest