Re: usb/168132: [umass] MATSHITA memory card size reported wrong, mount impossible

2012-05-27 Thread Rene Ladan
The following reply was made to PR usb/168132; it has been noted by GNATS.

From: Rene Ladan 
To: bug-follo...@freebsd.org
Cc:  
Subject: Re: usb/168132: [umass] MATSHITA memory card size reported wrong,
 mount impossible
Date: Mon, 28 May 2012 08:37:06 +0200

 Note that 0x1dc (the high 32 bits of the number of sectors reported
 on amd64) == 31260672-1 which is the number of sectors reported on i386.
 
 -- 
 http://www.rene-ladan.nl:8080/
 
 GPG fingerprint = ADBC ECCD EB5F A6B4 549F  600D 8C9E 647A E564 2BFC
 (subkeys.pgp.net)
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Lego NXT brick communication error with libusb

2010-12-13 Thread Rene Ladan
Op 14-12-2010 05:08, Hans Petter Selasky schreef:
> On Monday 13 December 2010 21:23:51 Rene Ladan wrote:
>> Op 13-12-2010 11:51, Hans Petter Selasky schreef:
>>> On Sunday 12 December 2010 23:40:54 Rene Ladan wrote:
>>>> Hi,
>>>>
>>>> I am writing a port [1] to control the Lego NXT brick with ROS, but when
>>>> I run a test program it fails (permissions for the USB device are 666).
>>>
>>>> This is on:
>>> What dmesg is shown? Are other [kernel] drivers hooking into the USB
>>> interfaces used by your user-land driver?
>>
>> dmesg shows just:
>> ugen3.2:  at usbus3
>> Vendor 0x0694 is Lego.
>>
>> I don't have other drivers hooking into the USB device I think:
>> % kldstat -v | grep usb
>>  276 usbus/uhub
>>  275 uhub/usb_linux
>>  273 uss820/usbus
>>  272 musbotg/usbus
>>  271 at91_udp/usbus
>>  270 xhci/usbus
>>  269 ehci/usbus
>>  268 uhci/usbus
>>  267 ohci/usbus
>>
>>> What is output from usbconfig -d X.Y dump_device_desc
>>> dump_curr_config_desc
>>
>> Attached.
>>
>> Rene
> 
> What happens if you remove that device reset line from your driver?
>
That does the trick, reading sensor data as user now works :) So on
Linux this reset line is harmless, but on FreeBSD it has to be removed.

Rene
-- 
http://www.rene-ladan.nl/

GPG fingerprint = ADBC ECCD EB5F A6B4 549F  600D 8C9E 647A E564 2BFC
(subkeys.pgp.net)
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Lego NXT brick communication error with libusb

2010-12-13 Thread Rene Ladan
Op 13-12-2010 11:51, Hans Petter Selasky schreef:
> On Sunday 12 December 2010 23:40:54 Rene Ladan wrote:
>> Hi,
>>
>> I am writing a port [1] to control the Lego NXT brick with ROS, but when
>> I run a test program it fails (permissions for the USB device are 666).
>> This is on:
>>
> 
> What dmesg is shown? Are other [kernel] drivers hooking into the USB 
> interfaces used by your user-land driver?
> 
dmesg shows just:
ugen3.2:  at usbus3
Vendor 0x0694 is Lego.

I don't have other drivers hooking into the USB device I think:
% kldstat -v | grep usb
276 usbus/uhub
275 uhub/usb_linux
273 uss820/usbus
272 musbotg/usbus
271 at91_udp/usbus
270 xhci/usbus
269 ehci/usbus
268 uhci/usbus
267 ohci/usbus

> What is output from usbconfig -d X.Y dump_device_desc dump_curr_config_desc
> 
Attached.

Rene
-- 
http://www.rene-ladan.nl/

GPG fingerprint = ADBC ECCD EB5F A6B4 549F  600D 8C9E 647A E564 2BFC
(subkeys.pgp.net)
ugen3.2:  at usbus3, cfg=0 md=HOST spd=FULL 
(12Mbps) pwr=ON

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x 
  bDeviceSubClass = 0x 
  bDeviceProtocol = 0x 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x0694 
  idProduct = 0x0002 
  bcdDevice = 0x 
  iManufacturer = 0x  
  iProduct = 0x  
  iSerialNumber = 0x0001  <0016530CA81C>
  bNumConfigurations = 0x0001 


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x0020 
bNumInterfaces = 0x0001 
bConfigurationValue = 0x0001 
iConfiguration = 0x  
bmAttributes = 0x00c0 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0002 
  bInterfaceClass = 0x00ff 
  bInterfaceSubClass = 0x00ff 
  bInterfaceProtocol = 0x00ff 
  iInterface = 0x  

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0001  
bmAttributes = 0x0002  
wMaxPacketSize = 0x0040 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 1
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0082  
bmAttributes = 0x0002  
wMaxPacketSize = 0x0040 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 



___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Lego NXT brick communication error with libusb

2010-12-12 Thread Rene Ladan
Hi,

I am writing a port [1] to control the Lego NXT brick with ROS, but when
I run a test program it fails (permissions for the USB device are 666).
This is on:

% uname -a
FreeBSD acer 9.0-CURRENT FreeBSD 9.0-CURRENT #5 r216351M: Fri Dec 10
14:13:33 CET 2010 r...@acer:/usr/obj/usr/src/sys/ACER  amd64

% rosrun nxt_python color_sensor_test.py
Traceback (most recent call last):
  File
"/usr/local/ros/stacks/nxt/nxt_python/sensor_tests/color_sensor_test.py", line
42, in 
test_sensors(sock.connect())
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/usbsock.py", line
44, in connect
self.handle.reset()
usb.USBError: Unknown error

Looking into usbsock.py:
  self.handle = self.device.open()
  self.handle.setConfiguration(1)
  self.handle.claimInterface(0)
  self.handle.reset()
where self.device points to the USB end point for the NXT device (vendor
0x694, product 0x2)

However, if I run the same program as root it fails a bit later:

# rosrun nxt_python color_sensor_test.py
-1
Traceback (most recent call last):
  File
"/usr/local/ros/stacks/nxt/nxt_python/sensor_tests/color_sensor_test.py", line
42, in 
test_sensors(sock.connect())
  File
"/usr/local/ros/stacks/nxt/nxt_python/sensor_tests/color_sensor_test.py", line
11, in test_sensors
cs = ColorSensor(b, PORT_1)
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/sensor.py", line
256, in __init__
self.set_light_color(None)
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/sensor.py", line
278, in set_light_color
self.set_input_mode()
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/sensor.py", line
71, in set_input_mode
self.mode)
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/brick.py", line 22,
in poll
self.sock.send(str(ogram))
  File "/usr/local/ros/stacks/nxt/nxt_python/src/nxt/usbsock.py", line
65, in send
self.handle.bulkWrite(self.blk_out.address, data)
usb.USBError: Unknown error

where self.handle is initialized in the same way as above.

It works in Ubuntu 10.10, both native and when running from VirtualBox 4
(which has USB passthrough) under the above FreeBSD.

Does anybody have an idea what could be wrong?

Thanks,
Rene

[1] ftp://rene-ladan.nl/pub/freebsd/ros-nxt-0.1.0.tar.bz2
SIZE = 3842
SHA256 = a7a30bc5ef77230d6846577d3a4b1c7262d1c654ed32fcf0d8701c07c0867bea
-- 
http://www.rene-ladan.nl/

GPG fingerprint = ADBC ECCD EB5F A6B4 549F  600D 8C9E 647A E564 2BFC
(subkeys.pgp.net)
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: devel/libusb port: bug in one of the patches

2009-07-31 Thread Rene Ladan
2009/7/30 Tiernan :
> Hi Rene,
>
> The patch files/patch-bsd.c in the ports tree for devel/libusb contains a
> hack that sets the fd to be non blocking to work around USB_SET_TIMEOUT on
> ugen, however on my system (6.4-RELEASE) ugen does indeed support
> USB_SET_TIMEOUT, and the hack breaks various things as it does not properly
> implement the timeout, just sets it nonblocking.
>
> I'm not sure what versions of FreeBSD do not support USB_SET_TIMEOUT,
> however if memory serves 5.x is deprecated, so I'm guessing its not needed
> any more so might be useful to axe.
>
I'm now running 8.X myself which has devel/libusb built in, so maybe
it's better to assign the list to this.

René
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: ports/132246: [PATCH] Make devel/libusb play nice with new usb2

2009-03-02 Thread Rene Ladan
This patch fixes USB access on FreeBSD >= 800063 by including
legacy/dev/usb/usb.h instead of dev/usb/usb.h on those systems;
however, is the legacy directory going to stay in 8.0-RELEASE and
onwards?  If not, this patch is invalid and another solution must be
sought.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Fwd: ports/128549: devel/libusb : fix runtime error

2008-11-14 Thread Rene Ladan
Case closed :)

Rene

-- Forwarded message --
From:  <[EMAIL PROTECTED]>
Date: 2008/11/14
Subject: Re: ports/128549: devel/libusb : fix runtime error
To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]


Synopsis: devel/libusb : fix runtime error

State-Changed-From-To: open->closed
State-Changed-By: pav
State-Changed-When: Fri Nov 14 09:51:02 UTC 2008
State-Changed-Why:
Committed, thanks!

http://www.freebsd.org/cgi/query-pr.cgi?pr=128549



-- 
http://www.rene-ladan.nl/

GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Fwd: Patch for libusb

2008-08-25 Thread Rene Ladan
Hi,

this is about a one-line patch for  libusb-0.1.12 which is available
in the ports tree as devel/libusb.

Is it ok to send a problem report for this?

Regards,
Rene

-- Forwarded message --
From: Volker Theile <[EMAIL PROTECTED]>
Date: 2008/8/24
Subject: Re: Patch for libusb
To: Rene Ladan <[EMAIL PROTECTED]>


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rene Ladan wrote:
| Volker Theile schreef:
|> Hello,
|>
|> i had to modify the bsd.c patch to get NUT (Network UPS tools)
working correctly when i attach an UPS via USB to my FreeBSD machine.
Without the patch the communication breaks every few seconds because
of an full read buffer. NUT checks the input buffer too fast, so the
kernel or something else blocks which will cause an communication
break to the UPS. Don't know if i have explained it correctly, but it
works.
|>
| The only difference between this patch and the one in devel/libusb/files is
| that the fd is opened in non-blocking mode, right?
|
| Regards,
| Rene
Yes, that's correct.

I've found the origin article where i've read about that patch for NetBSD.
http://wiki.botka.homeunix.org/bin/view/Main/NetworkUpsToolsUsb

- -- cut 


~  todo:

~   1. upsmon section
~   2. Install libusb 0.1.12 ,0.1.11 includes a bug fix for *BSD to
allow short reads. Without thisvarious status is not returned from
UPS.
~   3. Problem with libusb on netBSD in that the Function
usb_interrupt_read() calls read() which blocks on read from usb until
buffer is full. Change bsd.c in libusb

Fd = ensure_ep_open(dev, ep, 0, O_RDONLY)

To

Fd = ensure_ep_open(dev, ep, 0, O_RDONLY | O_NONBLOCK)

- -- cut 

I  don't know whether this fix has any consequences for other
applications, but for NUT it helps and now i can use my UPS via USB.

Regards
Volker


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkixrrQACgkQzsRXLGDcg0pMugCeKg2BtXAx+PjneOUKRhp+j5Bk
+kAAn3DabDmqu9OSLrG1zoO0tupgeqqZ
=ksxG
-END PGP SIGNATURE-




-- 
http://www.rene-ladan.nl/

GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Call for Testers: FreeBSD webcam driver (and more)

2007-01-31 Thread Rene Ladan
Luigi Rizzo schreef:
> On Wed, Jan 31, 2007 at 01:23:05PM +0100, Rene Ladan wrote:
>> Luigi Rizzo schreef:
>>> I think I reached a first interesting milestone in my project
>>> to build an emulation layer to compile linux device drivers on FreeBSD.
>>>
>>> I managed to build a FreeBSD port of the linux 'gspca' driver (which claims
>>> to support 228 different webcams) with basically no modifications to
>>> the original source. So it would be good if someone could give a try
>>> to this code, either on -current or -stable, keeping in mind that
>>> this is NOT PRODUCTION READY yet.
>>>
>> [...]
>>> together of course with source code, and even binary modules
>>> for FreeBSD 6.2.
>>> Basically I would like to know how it builds/works on -current,
>>> have reports on cameras that work with it and those which don't
>>> and so on.
>> [...]
>>
>> The binary modules also load on CURRENT i386 as of 2007/01/30,
>> dmesg shows
>>
>>> usb_spca5xx_init: gspca driver 01.00.12 registered
>> but it doesn't recognize the Xbox360 webcam (vendor 0x45e, product 0x294) :
>>
>>> spcaDetectCamera called vend 0x45e prod 0x294 p 0xc7a8d334
>>> spcaCameraDetect failed
>> neither does it recognize the builtin USB 2.0 webcam of my Asus A6JE
>> laptop (Syntek, product 0xa311), at least no /dev/video* show up.
> 
> ok thanks for the work anyways... i see there is a
> project on sourceforge for this one but probably not complete yet
> 
> http://syntekdriver.sourceforge.net/index.php?mode=documentation
> 
Might be worth a try :)

> while i haven't found anything on the web for the xbox thing.
>
Me neither.  The xbox camera only creates a /dev/ugenX, but no /dev/ugenX.Y

The camera is recognized as:
> ugen0: Microsoft Video Camera, rev 2.00/1.50, addr 2

>   cheers
>   luigi
> 
Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Call for Testers: FreeBSD webcam driver (and more)

2007-01-31 Thread Rene Ladan
Luigi Rizzo schreef:
> I think I reached a first interesting milestone in my project
> to build an emulation layer to compile linux device drivers on FreeBSD.
> 
> I managed to build a FreeBSD port of the linux 'gspca' driver (which claims
> to support 228 different webcams) with basically no modifications to
> the original source. So it would be good if someone could give a try
> to this code, either on -current or -stable, keeping in mind that
> this is NOT PRODUCTION READY yet.
> 
[...]
> together of course with source code, and even binary modules
> for FreeBSD 6.2.
> Basically I would like to know how it builds/works on -current,
> have reports on cameras that work with it and those which don't
> and so on.
[...]

The binary modules also load on CURRENT i386 as of 2007/01/30,
dmesg shows

> usb_spca5xx_init: gspca driver 01.00.12 registered

but it doesn't recognize the Xbox360 webcam (vendor 0x45e, product 0x294) :

> spcaDetectCamera called vend 0x45e prod 0x294 p 0xc7a8d334
> spcaCameraDetect failed

neither does it recognize the builtin USB 2.0 webcam of my Asus A6JE
laptop (Syntek, product 0xa311), at least no /dev/video* show up.

>   cheers
>   luigi

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


[Fwd: pp->mediasize == 0 when reattaching physical medium ?]

2007-01-07 Thread Rene Ladan


 Originele bericht 
Onderwerp: pp->mediasize == 0 when reattaching physical medium ?
Datum: Sun, 07 Jan 2007 15:30:12 +0100
Van: Rene Ladan <[EMAIL PROTECTED]>
Aan: [EMAIL PROTECTED]
CC: Poul-Henning Kamp <[EMAIL PROTECTED]>
Referenties: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

Rene Ladan schreef:
> Rene Ladan schreef:
>> Poul-Henning Kamp schreef:
>>> In message <[EMAIL PROTECTED]>, Rene Ladan writes:
>>>> Hi,
>>>>
>>>> I've written an extension to /sys/geom/geom_mbr.c to slice up xbox360
>>>> hard disks and memory units.  The patch for revision 1.68 (i.e. CURRENT)
>>>> is at http://home.tisali.nl/rladan/freebsd/geom_mbr.c.diff
>>> This is wrong, you should make a geom_xbox360 class instead.
>>>
>> Ok, I made a geom_xbox360 class and restored geom_mbr.c
>>
>> The new class consists of three files at the above website.
>>
>> geom_xbox360.c : the class, put it in /sys/geom
>> geom_xbox360::Makefile : Makefile for /sys/modules/geom/geom_xbox360/
>> Makefile.diff : patch for /sys/modules/geom/Makefile
>>
>>
> I've uploaded a new version of geom_xbox360.c.  The class now works
> correctly except for:
> 
> 1) If you kldload the class and plug in a physical medium afterwards,
> then pp->mediasize == 0 so the taste function fails.  This does not
> happen if the medium is plugged in before the kldload or when using dd
> images using mdconfig.  I think that the taste function is called before
> the physical medium (here da0) is properly initialized.  MBR media don't
> suffer from this because mbr_taste() doesn't check pp->mediasize.  A
> dmesg is attached.
> 
I am able to reproduce this with a standard USB 1 memory stick.  The
medium is
correctly tasted when kldloading after the medium is plugged in, or when the
class is kldloaded and you finish making the stick look like an xbox360
medium.

I've uploaded a new version of the class, which enables experimenting
with a normal USB stick. See the note at lines 53-56 of geom_xbox360.c
Note that this extra experimenting code really doesn't belong in the
class, so I'll remove it sooner or later.

It might be related to usb/80361, usb/89954 (the 'size 0' part of the
description), and usb/97175.  This suggests that someone(tm) needs to
take a look at umass(4).

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001



-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kern/104292: system lockup on forced umount of usb-storage device

2006-10-11 Thread Rene Ladan
The following reply was made to PR usb/104292; it has been noted by GNATS.

From: Rene Ladan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED],  [EMAIL PROTECTED]
Cc:  
Subject: Re: kern/104292: system lockup on forced umount of usb-storage device
Date: Wed, 11 Oct 2006 14:05:27 +0200

 I encountered this situation too and have a kernel dump available for
 debugging (1043216 kB uncompressed).
 
 Regards,
 Rene
 -- 
 GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
 (subkeys.pgp.net)
 
 "It won't fit on the line."
-- me, 2001
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/103418: [usb] [patch] usbhidctl: add ability to write output and feature items

2006-10-11 Thread Rene Ladan
The following reply was made to PR usb/103418; it has been noted by GNATS.

From: Rene Ladan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED],  [EMAIL PROTECTED]
Cc:  
Subject: Re: usb/103418: [usb] [patch] usbhidctl: add ability to write output
 and feature items
Date: Wed, 11 Oct 2006 13:16:18 +0200

 This is a multi-part message in MIME format.
 --060002000308090501080105
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Attached is the patch for the corresponding manual page.
 
 Rene.
 -- 
 GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
 (subkeys.pgp.net)
 
 "It won't fit on the line."
-- me, 2001
 
 
 --060002000308090501080105
 Content-Type: text/x-patch;
  name="pr-usbhidctl.1.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="pr-usbhidctl.1.diff"
 
 --- /usr/src/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 18 14:43:55 2005
 +++ usbhidctl.1Tue Sep 19 23:46:47 2006
 @@ -35,7 +35,7 @@
  .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  .\" POSSIBILITY OF SUCH DAMAGE.
  .\"
 -.Dd July 12, 1998
 +.Dd September 20, 2006
  .Dt USBHIDCTL 1
  .Os
  .Sh NAME
 @@ -51,13 +51,22 @@
  .Op Fl t Ar table
  .Op Fl v
  .Op Ar item ...
 +.Nm
 +.Fl f Ar device
 +.Op t ar table
 +.Fl w Ar name Ns = Ar value ...
  .Sh DESCRIPTION
  The
  .Nm
 -utility can be used to dump the state of a USB HID (Human Interface Device).
 +utility can be used to dump or modify the state of a USB HID (Human Interface 
Device).
  Each named
  .Ar item
  is printed.
 +If the
 +.Fl w
 +flag is specified
 +.Nm
 +attempts to set the specified items to the given values.
  .Pp
  The options are as follows:
  .Bl -tag -width Ds
 @@ -67,6 +76,7 @@
  Specify a path name for the device to operate on.
  .It Fl l
  Loop and dump the device data every time it changes.
 +Only 'input' items are displayed in this mode.
  .It Fl n
  Suppress printing of the item name.
  .It Fl r
 @@ -75,6 +85,9 @@
  Specify a path name for the HID usage table file.
  .It Fl v
  Be verbose.
 +.It Fl w
 +Change item values.
 +Only 'output' and 'feature' kinds can be set with this option.
  .El
  .Sh FILES
  .Pa /usr/share/misc/usb_hid_usages
 @@ -91,4 +104,4 @@
  .Sh BUGS
  The
  .Nm
 -utility cannot show nor set output and feature items.
 +utility cannot show feature items.
 
 --060002000308090501080105--
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


usb descriptor bogus?

2006-10-08 Thread Rene Ladan
Hi,

I came up with an output descriptor for the Xbox 360 controller, but the
output from usbhidctl(1) is not completely as expected.  The attached
file rdesc.txt contains the actual results, with lines starting with #
containing the expected results.

The output was generated using usbhidctl(1) and libusbhid from OpenBSD
with -rv as argument.

I also attached the descriptor itself (in .h and .hid format), the .hid
file was validated using Descriptor Tool 2.4.  This is a small windows
program obtainable from http://www.usb.org/developers/hidpage/dt2_4.zip

Any ideas what is wrong with the descriptor (or maybe libusbhid) ?

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001



xbox360gp.hid
Description: Binary data
/*-
 * Copyright (c) 2005 Ed Schouten <[EMAIL PROTECTED]>, Rene Ladan <[EMAIL 
PROTECTED]>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *notice, this list of conditions and the following disclaimer in the
 *documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/sys/dev/usb/uxb360gp_rdesc.h,v 1.2 2005/12/31 04:38:50 mux Exp 
$
 */

/* FIXME? output descriptors for led/rumblers, see xbox 1 gamepad descriptor 
for example */
static const uByte uhid_xb360gp_report_descr[] = {
0x05, 0x01, /* USAGE PAGE (Generic Desktop) */
0x09, 0x05, /* USAGE (Gamepad)  */
0xa1, 0x01, /* COLLECTION (Application) */
/* Input section */
/* Unused */
0x75, 0x08, /*  REPORT SIZE (8) */
0x95, 0x01, /*  REPORT COUNT (1)*/
/* next 2 lines found by DT 2.4 */
0x15, 0x00, /*  LOGICAL MINIMUM (0) */
0x25, 0x14, /*  LOGIXAL MAXIMUM (20)*/
0x81, 0x01, /*  INPUT (Constant)*/
/* Byte count */
0x75, 0x08, /*  REPORT SIZE (8) */
0x95, 0x01, /*  REPORT COUNT (1)*/
0x05, 0x01, /*  USAGE PAGE (Generic Desktop)*/
0x09, 0x3b, /*  USAGE (Byte Count)  */
0x81, 0x01, /*  INPUT (Constant)*/
/* D-Pad */
0x05, 0x01, /*  USAGE PAGE (Generic Desktop)*/
0x09, 0x01, /*  USAGE (Pointer) */
0xa1, 0x00, /*  COLLECTION (Physical)   */
0x75, 0x01, /*   REPORT SIZE (1)*/
0x15, 0x00, /*   LOGICAL MINIMUM (0)*/
0x25, 0x01, /*   LOGICAL MAXIMUM (1)*/
0x35, 0x00, /*   PHYSICAL MINIMUM (0)   */
0x45, 0x01, /*   PHYSICAL MAXIMUM (1)   */
0x95, 0x04, /*   REPORT COUNT (4)   */
0x05, 0x01, /*   USAGE PAGE (Generic Desktop)   */
0x09, 0x90, /*   USAGE (D-Pad Up)   */
0x09, 0x91, /*   USAGE (D-Pad Down) */
0x09, 0x93, /*   USAGE (D-Pad Left) */
0x09, 0x92, /*   USAGE (D-Pad Right)*/
0x81, 0x02, /*   INPUT (Data, Variable, Absolute)   */
0xc0,   /*  END COLLECTION  */
/* Buttons 5-11 */
0x75, 0x01, /*  REPORT SIZE (1) */
0x15, 0x00, /*  LOGICAL MINIMUM (0) */
0x25, 0x01, /*  LOGICAL MAXIMUM (1) */
0x35, 0x00, /*  PHYSICAL MINIMUM (0)*/
0x45, 0x01, /*  PHYSICAL MAXIMUM (1)*/
0x95, 0x07, /*  REPORT COUNT (7)*/
 

Re: anyone working on setting output items with usbhidctl(1) ?

2006-10-03 Thread Rene Ladan
Jindra Fucik schreef:
>> Hi,
>>
>> is anyone working on setting output items with usbhidctl(1) ?
>>
>> I thought that something like -s "feature1=value1,feature2=value2,..."
>> would be nice to have.
> 
> Hi Rene, have you any progress? I do some tests on uhid & write and have
> no positive feedback.
> 
There is some progress.  I've sent PR usb/103418 containing a patch to
usbhidctl(1).
You can test the patch if you have a hid with a known output descriptor:

# usbhidctl -f /dev/uhid0 -w name=value

should do the trick.

When I test the patch with my Xbox 360 controller which contains a
reverse-engineered output descriptor it crashes when calling
hid_set_data() from libusbhid.  I guess I'm not initializing the
variable *buf correctly (it contains 0x800).

Alternatively you can import usbhidctl(1) from OpenBSD/NetBSD (some
trivial patches are needed, like s/hid_start()/hid_init() ) which has
hopefully a working -w option.

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


rfc: import usbhidctl(1) from OpenBSD

2006-10-01 Thread Rene Ladan
Hi,

I was thinking about the idea of sending a PR to replace our
usbhidctl(1) with that of OpenBSD/NetBSD.

It has the following advantages:
* the -w option hopefully works, the implementation of PR usb/103418
seems to be buggy
* the command 'usbhidctl -f DEV item' to display the value of a single
item actually works (our implementation returns nothing)
* in sync with OpenBSD and NetBSD
* my own PR usb/103418 and docs/103420 can be trashed.

I've sucessfully tested OpenBSD's usbhidctl(1)
(http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/usbhidctl/usbhid.c,
revision 1.7) with an Xbox 360 controller (the output report descriptor
is under development).
It compiles fine after applying the attached patch using `cc usbhid.c -o
OUTFILE -lusbhid`.

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

--- openbsd-usbhid.c.orig	Sun Oct  1 23:06:23 2006
+++ openbsd-usbhid.c	Sun Oct  1 22:57:55 2006
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -932,8 +933,7 @@
 		/* NOTREACHED */
 	}
 
-	if (hid_start(table) == -1)
-		errx(1, "hid_init");
+	hid_init(table);
 
 	if (dev[0] != '/') {
 		snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s",
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usb/101775: [libusbhid] [patch] possible error in report descriptor parsing

2006-09-24 Thread Rene Ladan
The following reply was made to PR usb/101775; it has been noted by GNATS.

From: Rene Ladan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED],  [EMAIL PROTECTED]
Cc:  
Subject: Re: usb/101775: [libusbhid] [patch] possible error in report descriptor
 parsing
Date: Sun, 24 Sep 2006 21:43:32 +0200

 I saw this error too (it is an error, see section 6.2.2.7, page 35, of
 the USB HID 1.11 specification), but fixing this gave a physical minimum
 of 32768 (no minus sign) instead of -32768 (with minus sign) for
 "Generic_Desktop.{Rx,Ry,X,Y}" when plugging in an Xbox 360 controller.
 
 /usr/src/sys/dev/usb/uxb360gp_rdesc.h (RELENG_6) shows (line 110):
 
  0x36, 0x00, 0x80,   /*  PHYSICAL MINIMUM (-32768)   */
 
 so -32768 (with minus sign) is the correct value.  I could not see any
 sign error in the sources of libusbhid or usbhidctl though.
 
 Any clues?
 
 Regards,
 Rene
 -- 
 GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
 (subkeys.pgp.net)
 
 "It won't fit on the line."
-- me, 2001
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


usb/103418: [usb] [patch] usbhidctl: add ability to write output and feature items

2006-09-20 Thread Rene Ladan

>Number: 103418
>Category:   usb
>Synopsis:   [usb] [patch] usbhidctl: add ability to write output and 
>feature items
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-usb
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 20 14:40:25 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Rene Ladan
>Release:FreeBSD 6.2-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD dyn172.win.tue.nl 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE
#5: Tue Sep 19 21:13:50 CEST 2006
[EMAIL PROTECTED]:/usr/obj/usr/src6/sys/RENE i386
>Description:
The usbhidctl(1) utility can read input items, but not set output nor
feature items.  This patch, loosely based on OpenBSD's usbhidctl, adds
write support to usbhidctl(1) so that it can set output and feature items.

Note: I am unable to test this patch as I do not have any usb hid with a
known output report descriptor.  It is therefore advisable that a committer
with good hid knowledge or a device with a known output report descriptor
reviews this patch before committing it.  But at least it compiles :)
>How-To-Repeat:
>Fix:

--- /usr/src/usr.bin/usbhidctl/usbhid.c Mon May 26 06:58:26 2003
+++ usbhid.cTue Sep 19 23:59:07 2006
@@ -1,7 +1,7 @@
 /* $NetBSD: usbhid.c,v 1.14 2000/07/03 02:51:37 matt Exp $ */
 /* $FreeBSD: src/usr.bin/usbhidctl/usbhid.c,v 1.9 2003/05/26 04:58:26
mdodd Exp $ */

-/*
+/*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -51,6 +51,8 @@
 #include 
 #include 

+#define DELIM_SET '='
+
 int verbose = 0;
 int all = 0;
 int noname = 0;
@@ -66,6 +68,8 @@
 void rev(struct hid_item **p);
 void prdata(u_char *buf, struct hid_item *h);
 void dumpdata(int f, report_desc_t r, int loop);
+void wrdata(u_char *buf, struct hid_item *h, char const *name);
+void setdata(int f, report_desc_t r);
 int gotname(char *n);

 int
@@ -96,6 +100,7 @@

fprintf(stderr, "usage: %s -f device [-l] [-n] [-r] [-t tablefile]
[-v] name ...\n", __progname);
fprintf(stderr, "   %s -f device [-l] [-n] [-r] [-t tablefile]
[-v] -a\n", __progname);
+   fprintf(stderr, "   %s -f device [-t tablefile] -w name=value
...\n", __progname);
exit(1);
 }

@@ -254,6 +259,57 @@
free(dbuf);
 }

+void
+wrdata(u_char *buf, struct hid_item *h, char const *name)
+{
+   u_int dataval;
+   char const *valuesep;
+   valuesep = strchr(name, DELIM_SET);
+   if (valuesep) {
+   /* Set up variable */
+   dataval = (u_int)strtol(valuesep + 1, NULL, 10);
+   hid_set_data(buf, h, dataval);
+   }
+}
+
+void
+setdata(int f, report_desc_t rd)
+{
+   struct hid_data *d;
+   struct hid_item h, *hids, *n;
+   int dlen;
+   u_char *dbuf;
+   u_int32_t colls[100];
+   int sp = 0;
+   int i;
+
+   for (d = hid_start_parse(rd, 1<next) {
+   for (i = 0; i < nnames; i++)
+   wrdata(dbuf + (reportid != 0), n, names[i]);
+   }
+   write(f, dbuf, dlen);
+   free(dbuf);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -263,9 +319,10 @@
int ch;
int repdump = 0;
int loop = 0;
+   int wflag = 0;
char *table = 0;

-   while ((ch = getopt(argc, argv, "af:lnrt:v")) != -1) {
+   while ((ch = getopt(argc, argv, "af:lnrt:vw")) != -1) {
switch(ch) {
case 'a':
all++;
@@ -288,6 +345,9 @@
case 'v':
verbose++;
break;
+   case 'w':
+   wflag = 1;
+   break;
case '?':
default:
usage();
@@ -295,7 +355,11 @@
}
argc -= optind;
argv += optind;
-   if (dev == 0)
+   if (dev == 0 || (loop && (wflag || repdump)))
+   /*
+* No device specified, or attempting to loop and set
+* or dump report at the same time
+*/
usage();
names = argv;
nnames = argc;
@@ -325,7 +389,11 @@
printf("Report descriptor:\n");
dumpitems(r);
}
-   if (nnames != 0 || all)
+
+   if (wflag)
+   setdata(f, r);
+
+   if ((nnames != 0 && !wflag) || all)
dumpdata(f, r, loop);

hid_dispose_report_desc(r);

>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: anyone working on setting output items with usbhidctl(1) ?

2006-09-18 Thread Rene Ladan

2006/9/17, Rene Ladan <[EMAIL PROTECTED]>:

Hi,

is anyone working on setting output items with usbhidctl(1) ?

I thought that something like -s "feature1=value1,feature2=value2,..."
would be nice to have.


I noticed that the usbhidctl(1) tool in OpenBSD has a -w option to set
output and feature items, so I'll try to port it to the FreeBSD tool.


I'm not subscribed to the usb@ list, so please cc me.


Kind regards,
Rene
--
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: anyone working on setting output items with usbhidctl(1) ?

2006-09-18 Thread Rene Ladan

2006/9/18, Ed Schouten <[EMAIL PROTECTED]>:

Hello Rene,

* Rene Ladan <[EMAIL PROTECTED]> wrote:
> is anyone working on setting output items with usbhidctl(1) ?
>
> I'm trying to add LED/rumbler support for the Xbox 360 Gamepad to
> uhid(4), but there doesn't seem to be a userland tool to test output
> items and the output report descriptor doesn't seem to be publicly
> available (i.e. I must reverse-engineer it).
>
> This device has 4 LEDs which can be controlled with the command 01 03
> xx, where xx ranges from 0 to 255.
> It also has two rumble motors which can be controlled with 00 08 00 bb
> ll 00 00 00, where bb and ll both range from 0 to 255.

Try the following C code:

| #include 
| #include 
|
| int
| main(int argc, char *argv[])
| {
|   char buffer[3] = { 1, 3, 0 };
|   int fd;
|
|   fd = open("/dev/ugen0.2", O_WRONLY);
|   if (fd < 0) {
|   fprintf(stderr, "Cannot open device\n");
|   return (-1);
|   }
|
|   write(fd, buffer, sizeof buffer);
|   close(fd);
|
|   return (0);
| }

I'm currently toying around with the headset, so I've disabled the
uhid(4) driver, so the LED on the gamepad keeps blinking. Running the
application above turns off the LED. I guess it should also work when
you write it to /dev/uhidX.


I tried that too, it does not work on /dev/uhidX (my code opened the
device read/write instead of write-only).

I'll try to extend the HID descriptor to support the LED and rumblers.

--
 Ed Schouten <[EMAIL PROTECTED]>
 WWW: http://g-rave.nl/





Regards,
Rene
--
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


anyone working on setting output items with usbhidctl(1) ?

2006-09-17 Thread Rene Ladan
Hi,

is anyone working on setting output items with usbhidctl(1) ?

I'm trying to add LED/rumbler support for the Xbox 360 Gamepad to
uhid(4), but there doesn't seem to be a userland tool to test output
items and the output report descriptor doesn't seem to be publicly
available (i.e. I must reverse-engineer it).

This device has 4 LEDs which can be controlled with the command 01 03
xx, where xx ranges from 0 to 255.
It also has two rumble motors which can be controlled with 00 08 00 bb
ll 00 00 00, where bb and ll both range from 0 to 255.

I thought that something like -s "feature1=value1,feature2=value2,..."
would be nice to have.

I'm not subscribed to the usb@ list, so please cc me.

Kind regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [Libusb-devel] [PATCH] FreeBSD fix for usb_control_msg()

2006-08-04 Thread Rene Ladan
[EMAIL PROTECTED] schreef:
> I don't know how Net- or Open- handle this, but
> FreeBSD returns the number of transmited bytes in
> req.ucr_actlen, not in req.ucr_request.wLength.
> (/usr/include/dev/usb/usb.h:544:
> int ucr_actlen; /* actual length transferred */
> 
> So then:
> --- bsd.c   Sat Mar  4 03:52:46 2006
> +++ ../../bsd.c Thu Aug  3 19:19:15 2006
> @@ -476,8 +476,11 @@
>if (ret < 0)
>  USB_ERROR_STR(-errno, "error sending control message: %s",
>strerror(errno));
> -
> +#ifdef __FreeBSD_kernel__
> +  return req.ucr_actlen;
> +#else
>return UGETW(req.ucr_request.wLength);
> +#endif
>  }
>  
>  int usb_os_find_busses(struct usb_bus **busses)
>
This seems correct, wLength is a uWord defined in usb_device_request_t
(usb/usb.h:112).
usb_device_request_t is included in usb_ctl_request (usb/usb.h:542),
which is the structure in which ucr_actlen (int) is defined (usb/usb.h:546)

I am cc'ing freebsd-usb@ since  I'm not sure about this patch...

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
-- me, 2001

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"