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

> On Friday 16 November 2012 10:29:12 Jan Beich wrote:
>
>> Hans Petter Selasky <hselasky@c2i.net> writes:
>> >> And my patch for do-configure + build fix should follow
>> > 
>> > Hi,
>> > 
>> > I think you need to add:
>> > 
>> > -i media_tree/drivers/input/joystick
>> > 
>> > to the linux_make arguments.
>> 
>> This doesn't affect checksum of the produced binary.
>> 
>> > Because that Makefile is not linked with the parent one I think.
>> > 
>> > Then re-run the commands.
>> 
>> I'm building only
>> 
>>   media_tree/drivers/input/joydev.c
>>   media_tree/drivers/input/joystick/xpad.c
>> 
>> and they're both present in the resulting binary.
>> 
>> I think my gamepad is generic enough to not need any driver from
>> media_tree/drivers/input/joystick/. On linux joydev works with usbhid.
>> So, webcamd probably needs to attach to /dev/uhidN, not /dev/ugenN.M.
>> 
>> > --HPS
>
> Hi,
>
> Can you check that your device is present in the ID-table in xpad.c:
>
> static struct usb_device_id xpad_table [] = {
>
> And add some prints in the probe section in xpad.c?

OK, I've added

  // xpad_table[]
  { USB_DEVICE(0x044f, 0xb315) }, /* Thrustmaster dual analog 3.2 */

  // xpad_device[]
  { 0x044f, 0xb315, "Thrustmaster dual analog 3.2", 0, XTYPE_XBOX360 },

  # without/with xpad_device[] line
  $ ./webcamd -d 3.2
  Attached to ugen3.2[0]
 -@ name="Generic X-Box pad" phys="usb-/dev/usb-/dev/usb/input0"
 +@ name="Thrustmaster dual analog 3.2" phys="usb-/dev/usb-/dev/usb/input0"
  | xpad_set_up_abs(..., xpad_abs[0]=0)
  | xpad_set_up_abs(..., xpad_abs[1]=1)
  | xpad_set_up_abs(..., xpad_abs[2]=3)
  | xpad_set_up_abs(..., xpad_abs[3]=4)
  | __set_bit(xpad_common_btn[0]=304, ...)
  | __set_bit(xpad_common_btn[1]=305, ...)
  | __set_bit(xpad_common_btn[2]=307, ...)
  | __set_bit(xpad_common_btn[3]=308, ...)
  | __set_bit(xpad_common_btn[4]=315, ...)
  | __set_bit(xpad_common_btn[5]=314, ...)
  | __set_bit(xpad_common_btn[6]=317, ...)
  | __set_bit(xpad_common_btn[7]=318, ...)
 -| __set_bit(xpad_btn[0]=306, ...)
 -| __set_bit(xpad_btn[1]=309, ...)
 +| __set_bit(xpad360_btn[0]=310, ...)
 +| __set_bit(xpad360_btn[1]=311, ...)
 +| __set_bit(xpad360_btn[2]=316, ...)
  | xpad_set_up_abs(..., xpad_abs_pad[0]=16)
  | xpad_set_up_abs(..., xpad_abs_pad[1]=17)
  | xpad_set_up_abs(..., xpad_abs_triggers[0]=2)
  | xpad_set_up_abs(..., xpad_abs_triggers[1]=5)
  Creating /dev/input/event0

  $ chown foo:foo /dev/input/event0
  $ (cd /dev/input; ln -s event0 js0)
  $ /b/shank/bin/Shank
  ^C
  $ dmesg | fgrep Shank
  linux: pid 51084 (Shank): ioctl fd=23, cmd=0x4520 ('E',32) is not implemented (EVIOCGBIT)
  linux: pid 51084 (Shank): ioctl fd=23, cmd=0x4521 ('E',33) is not implemented (EVIOCGBIT)
  linux: pid 51084 (Shank): ioctl fd=23, cmd=0x6a11 ('j',17) is not implemented (JSIOCGAXES)
  linux: pid 51084 (Shank): ioctl fd=23, cmd=0x6a12 ('j',18) is not implemented (JSIOCGBUTTONS)
  linux: pid 51084 (Shank): ioctl fd=24, cmd=0x4506 ('E',6) is not implemented  (EVIOCGNAME)
  linux: pid 51084 (Shank): ioctl fd=24, cmd=0x6a13 ('j',19) is not implemented (JSIOCGNAME)

However, xpad isn't the right driver for my gamepad. Trying to press
first 4 buttons yields nothing and setting XBOX360 type doesn't help.

  # freebsd + webcamd
  $ hd /dev/input/js0
  ...
  ^C

  # ubuntu
  $ hd /dev/input/js0
  ...
  000000b0  d8 9a 56 00 00 00 01 02  60 ac 56 00 01 00 01 02  |..V.....`.V.....|
  000000c0  f0 ac 56 00 00 00 01 02  e0 ae 56 00 01 00 01 00  |..V.......V.....|
  000000d0  50 af 56 00 00 00 01 00  48 b1 56 00 01 00 01 03  |P.V.....H.V.....|
  000000e0  d0 b1 56 00 00 00 01 03  c0 b3 56 00 01 00 01 01  |..V.......V.....|
  ^C

Moving D-pad or 2 analog sticks does generate some output, still different.
An example for pressing "down" button on D-pad follows

  # freebsd + webcamd
  $ hd /dev/input/js0
  ...
  000005a0  5c f3 00 00 00 00 00 00  a1 00 08 00 00 00 00 00  |\...............|
  000005b0  01 00 30 01 01 00 00 00  5c f3 00 00 00 00 00 00  |..0.....\.......|
  000005c0  a2 00 08 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  000005d0  5c f3 00 00 00 00 00 00  9e fa 08 00 00 00 00 00  |\...............|
  000005e0  01 00 30 01 00 00 00 00  5c f3 00 00 00 00 00 00  |..0.....\.......|
  000005f0  a0 fa 08 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
  ^C

  # ubuntu
  $ hd /dev/input/js0
  ...
  00000090  10 8c 69 00 00 00 02 03  98 99 69 00 ff 7f 02 01  |..i.......i.....|
  ^C

Anything else to test e.g., wine built with linux/joystick.h support?

>
> Also, sometimes you need to specify the interface number to webcamd.
>
> It should not matter if uhid is attached or not.
>
> --HPS

--
a patch with printfs should follow
