Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2012 07:44:20 +0100
From:      Jan Beich <jbeich@tormail.org>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: linux joystick
Message-ID:  <1TZFkh-00091p-22@internal.tormail.org>
In-Reply-To: <201211152119.29494.hselasky@c2i.net> (Hans Petter Selasky's message of "Thu, 15 Nov 2012 21:19:29 %2B0100")
References:  <1TZ2UN-0007lV-2Q@internal.tormail.org> <201211152119.29494.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain
Content-Disposition: inline

Hans Petter Selasky <hselasky@c2i.net> writes:

> On Thursday 15 November 2012 17:37:37 Jan Beich wrote:
>
>> Many linux games and wine provide support only for linux joystick.
>> emulators/joytran helps but some games do not even support more than one
>> keyboard player e.g., Shank.
>> 
>> As devel/linux-js is nowadays broken I've tried to comile webcamd with
>> CONFIG_INPUT_JOYDEV but it still fails to attach to my usb gamepad.
>> OTOH, webcamd has no trouble attaching to my wacom tablet. Any clue
>> what may be missing?
>> 
>> --
>> # ubuntu (laptop)
>> [   33.907951] usb 2-1.5: new low-speed USB device number 3 using ehci_hcd
>> [   34.097118] input: Mega World Thrustmaster dual analog 3.2 as
>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/input/input15 [ 
>>  34.097409] generic-usb 0003:044F:B315.0001: input,hidraw0: USB HID v1.10
>> Gamepad [Mega World Thrustmaster dual analog 3.2] on
>> usb-0000:00:1d.0-1.5/input0 [   34.097427] usbcore: registered new
>> interface driver usbhid
>> [   34.097430] usbhid: USB HID core driver
>> 
>> # freebsd (foobox)
>> $ usbconfig -d 3.3 dump_curr_config_desc
>> ugen3.3: <Thrustmaster dual analog 3.2 Mega World> at usbus3, cfg=0 md=HOST
>> spd=LOW (1.5Mbps) pwr=ON
>> 
>> 
>>  Configuration index 0
>> 
>>     bLength = 0x0009
>>     bDescriptorType = 0x0002
>>     wTotalLength = 0x0022
>>     bNumInterfaces = 0x0001
>>     bConfigurationValue = 0x0001
>>     iConfiguration = 0x0000  <no string>
>>     bmAttributes = 0x00a0
>>     bMaxPower = 0x00af
>> 
>>     Interface 0
>>       bLength = 0x0009
>>       bDescriptorType = 0x0004
>>       bInterfaceNumber = 0x0000
>>       bAlternateSetting = 0x0000
>>       bNumEndpoints = 0x0001
>>       bInterfaceClass = 0x0003
>>       bInterfaceSubClass = 0x0000
>>       bInterfaceProtocol = 0x0000
>>       iInterface = 0x0000  <no string>
>> 
>>       Additional Descriptor
>> 
>>       bLength = 0x09
>>       bDescriptorType = 0x21
>>       bDescriptorSubType = 0x10
>>        RAW dump:
>>        0x00 | 0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0x6c,
>>        0x08 | 0x00
>> 
>>      Endpoint 0
>>         bLength = 0x0007
>>         bDescriptorType = 0x0005
>>         bEndpointAddress = 0x0081  <IN>
>>         bmAttributes = 0x0003  <INTERRUPT>
>>         wMaxPacketSize = 0x0008
>>         bInterval = 0x000a
>>         bRefresh = 0x0000
>>         bSynchAddress = 0x0000
>> 
>> $ webcamd -d 3.3
>> webcamd: Cannot find USB device
>
> Hi,
>
> How did you configure this?
>
> Did you install work/webcamd*/tools/linux_make ?
>
> And did you run "make -C work/webcamd* configure", after make extract patch?
>
> --HPS

I've added a proper do-configure and made sure joydev.o is actually built.

  $ nm =webcamd | fgrep joy
  0000000000408980 t joydev_cleanup
  0000000000407860 t joydev_connect
  0000000000407cd0 t joydev_disconnect
  0000000000407640 t joydev_event
  0000000000407630 t joydev_exit
  0000000000a0b190 d joydev_exit_p
  00000000004088d0 t joydev_fasync
  000000000069d960 r joydev_fops
  0000000000408a20 t joydev_free
  00000000009885a0 d joydev_handler
  000000000069d9e0 r joydev_ids
  0000000000407620 t joydev_init
  0000000000a09fd0 d joydev_init_p
  0000000000408140 t joydev_ioctl
  00000000004077f0 t joydev_match
  0000000000408750 t joydev_open
  00000000004080d0 t joydev_poll
  0000000000407d10 t joydev_read
  00000000004088e0 t joydev_release
  0000000000a104e0 b joydev_table
  0000000000988618 d joydev_table_mutex

I've also tried

  $ pkill devd
  $ kldunload uhid
  $ webcamd -d 3.2
  webcamd: Cannot find USB device

--
$ usbconfig -d 3.2 dump_device_desc
ugen3.2: <Thrustmaster dual analog 3.2 Mega World> at usbus3, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0008
  idVendor = 0x044f
  idProduct = 0xb315
  bcdDevice = 0x0101
  iManufacturer = 0x0001  <Mega World>
  iProduct = 0x0002  <Thrustmaster dual analog 3.2>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

$ usbhidctl -f /dev/uhid0 -r
Report descriptor:
Collection type=Application page=Generic_Desktop usage=Game_Pad
Collection type=Physical page=Generic_Desktop usage=Pointer
Input   rid=0 size=1 count=1 page=Button usage=Button_1, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_2, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_3, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_4, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_5, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_6, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_7, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_8, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_9, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_10, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_11, logical range 0..1
Input   rid=0 size=1 count=1 page=Button usage=Button_12, logical range 0..1
Input   rid=0 size=4 count=1 page=Generic_Desktop usage=Hat_Switch, logical range 0..7, physical range 0..270, unit=0x40 exp=0
Input   rid=0 size=8 count=1 page=Generic_Desktop usage=X, logical range -128..127, physical range 0..255
Input   rid=0 size=8 count=1 page=Generic_Desktop usage=Y, logical range -128..127, physical range 0..255
Input   rid=0 size=8 count=1 page=Generic_Desktop usage=Rz, logical range -128..127, physical range 0..255
Input   rid=0 size=8 count=1 page=Generic_Desktop usage=Slider, logical range 0..255, physical range 0..255
Output  rid=0 size=8 count=1 page=Generic_Desktop usage=0x00bb, logical range 0..255, physical range 0..255
Output  rid=0 size=8 count=1 page=Generic_Desktop usage=0x00bb, logical range 0..255, physical range 0..255
Output  rid=0 size=8 count=1 page=Generic_Desktop usage=0x00bb, logical range 0..255, physical range 0..255
Output  rid=0 size=8 count=1 page=Generic_Desktop usage=0x00bb, logical range 0..255, physical range 0..255
End collection
End collection
Total   input size 7 bytes
Total  output size 4 bytes
Total feature size 0 bytes


And my patch for do-configure + build fix should follow

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=joybuild.diff

Index: multimedia/webcamd/Makefile
===================================================================
--- multimedia/webcamd/Makefile	(revision 307263)
+++ multimedia/webcamd/Makefile	(working copy)
@@ -79,6 +79,10 @@ MAKE_ARGS+=" HAVE_DEBUG=YES"
 IGNORE=		requires FreeBSD 8.0-RELEASE or later
 .endif
 
+do-configure:
+	${MAKE} -C${WRKSRC}/tools/linux_make
+	${MAKE} configure -C${WRKSRC}
+
 post-patch:
 	@cd ${WRKSRC}/patches; ${SH} ./do_patch.sh
 
Index: multimedia/webcamd/files/patch-Makefile
===================================================================
--- multimedia/webcamd/files/patch-Makefile	(revision 0)
+++ multimedia/webcamd/files/patch-Makefile	(working copy)
@@ -0,0 +1,11 @@
+--- Makefile~
++++ Makefile
+@@ -277,7 +277,7 @@ help:
+ 	@echo "#"
+ 
+ configure:
+-	linux_make -c config \
++	tools/linux_make/linux_make -c config \
+ 		-i media_tree/drivers/input \
+ 		-i media_tree/drivers/media \
+ 		-i media_tree/drivers/staging/media \
Index: multimedia/webcamd/files/patch-joy
===================================================================
--- multimedia/webcamd/files/patch-joy	(revision 0)
+++ multimedia/webcamd/files/patch-joy	(working copy)
@@ -0,0 +1,29 @@
+--- config~
++++ config
+@@ -149,6 +149,8 @@ CONFIG_FW_LOADER=y
+ CONFIG_I2C=y
+ CONFIG_I2C_SI470X=y
+ CONFIG_INPUT=y
++CONFIG_INPUT_JOYDEV=y
++CONFIG_INPUT_JOYSTICK=y
+ CONFIG_INPUT_EVDEV=y
+ CONFIG_INPUT_TABLET=y
+ CONFIG_INPUT_TOUCHSCREEN=y
+@@ -167,6 +168,7 @@ CONFIG_IR_SANYO_DECODER=y
+ CONFIG_IR_SONY_DECODER=y
+ CONFIG_IR_STREAMZAP=y
+ CONFIG_IR_TTUSBIR=y
++CONFIG_JOYSTICK_XPAD=y
+ CONFIG_LIRC=y
+ CONFIG_LIRC_IGORPLUGUSB=y
+ CONFIG_LIRC_STAGING=y
+--- kernel/linux_defs.h~
++++ kernel/linux_defs.h
+@@ -220,6 +225,7 @@
+ })
+ #define	DEFAULT_POLLMASK POLLNVAL
+ #define	POLL_ERR POLLERR
++#define	IOCSIZE_MASK     (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+ #define	_IOC_TYPE(cmd) IOCGROUP(cmd)
+ #define	_IOC_SIZE(cmd) IOCPARM_LEN(cmd)
+ #define	_IOC_NR(cmd) ((cmd) & 0xFF)

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1TZFkh-00091p-22>