Re: Panic in usb_unref_device

2014-10-07 Thread Daniel O'Connor

On 3 Oct 2014, at 21:18, Hans Petter Selasky h...@selasky.org wrote:
 On 10/03/14 13:19, Daniel O'Connor wrote:
 Hi,
 I have a custom USB device based on the Cypress FX2 and we are finding that 
 with some older kernels it hangs - this was fixed in 
 https://svnweb.freebsd.org/base?view=revisionrevision=267240 but now it 
 panics with…
 
 There's a minor bug there. Can you test the attached patch?

Sorry for the late reply (there was a holiday on Monday here) - the patch seems 
to have fixed the crash, thanks!

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

___
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


Panic in usb_unref_device

2014-10-03 Thread Daniel O'Connor
Hi,
I have a custom USB device based on the Cypress FX2 and we are finding that 
with some older kernels it hangs - this was fixed in 
https://svnweb.freebsd.org/base?view=revisionrevision=267240 but now it panics 
with…

#7  0x80745a07 in usb_unref_device (cpd=0xfe0004b30680, 
crd=0xff812b6af860) at /usr/src/sys/dev/usb/usb_dev.c:348
#8  0x80748cbd in usb_ioctl (dev=value optimized out, cmd=3222040644, 
addr=0xfe002638 \002, fflag=value optimized out, 
td=0x81819850)
   at /usr/src/sys/dev/usb/usb_dev.c:1127
#9  0x807d05cb in devfs_ioctl_f (fp=0xfe0061d59190, com=3222040644, 
data=value optimized out, cred=value optimized out, td=0xfe0004e37920)
   at /usr/src/sys/fs/devfs/devfs_vnops.c:758
#10 0x80938456 in kern_ioctl (td=0xfe0004e37920, fd=3, 
com=3222040644, data=0xfe002638 \002) at file.h:311
#11 0x8093869d in sys_ioctl (td=0xfe0004e37920, 
uap=0xff812b6afa70) at /usr/src/sys/kern/sys_generic.c:696

And crd-rxfifo is NULL.

I haven’t looked very hard at this yet, but it is quite easy to reproduce.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

___
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: Test Results (was: Re: Do _any_ USB 3.0 cards actually work?)

2014-05-26 Thread Daniel O'Connor

On 26 May 2014, at 12:46, Ronald F. Guilmette r...@tristatelogic.com wrote:
 My desktop#1 system contains this dual port USB 3.0 PCIe interface card
 that I've already mentioned (VIA LV800 chipset):
 
   http://www.newegg.com/Product/Product.aspx?Item=17Z-0002-2
 
 My desktop#2 system contains this Anker 2-port USB 3.0 PCIe card:
 
 
 http://www.amazon.com/Anker%C2%AE-Uspeed-Express-20-pin-Connector/dp/B007SJGGAE/ref=pd_cp_pc_2/181-8193670-6916000
 
 I have just now checked that, and the big chip on that has written on
 the top of the chip VL800-Q8, so apparentlty this also contained the
 VIA[tm] VL 800 chipset.

So, this is the same USB3 controller I am using with success, the plot thickens 
:)

 My HTPC system contains whatever the heck kind of USB 3.0 controller
 Foxconn elected in include on the board for this system:
 
   http://www.newegg.com/Product/Product.aspx?Item=N82E16856119070

Your dmesg says it is a ASMedia ASM1042 USB 3.0 controller

 1)  On all three test systems, the current FreeBSD USB driver doesn't
 entirely like the Hitachi Touro Moble 500GB USB 3.0 drive.  In each case,
 connecting this drive results in a set of error messages like the following:
 
(probe0:umass-sim2:2:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 
 00 00 
(probe0:umass-sim2:2:0:0): CAM status: SCSI Status Error
(probe0:umass-sim2:2:0:0): SCSI status: Check Condition
(probe0:umass-sim2:2:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid 
 command operation code)
(probe0:umass-sim2:2:0:0): Error 22, Unretryable error
 
 That last line is clearly incorrect, and at the very least needs to be
 rephrased.  Speaking from personal experience, I can attest to the fact
 that there are no such things, in life or anywhere else, as an error that
 cannot be retried, ad infinitum.  (And I have the scars to priove it!)

You're reading too much into what the SCSI standard says, it wasn't written 
with human beings in mind ;)

It just means there is no point retrying because it isn't a transient error (I 
believe). This is typically caused by devices which reject legal SCSI commands 
hence HPS's suggestion to add a quirk so the SCSI stack doesn't try sending 
that command to the device.

Not sure on the rest of your stuff though, sorry.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Do _any_ USB 3.0 cards actually work?

2014-05-25 Thread Daniel O'Connor

On 25 May 2014, at 12:36, Daniel O'Connor docon...@gsoft.com.au wrote:
 I'll take pictures of them on Monday.

http://imgur.com/a/N8Dto

The non-working one uses an EtronTech EJ188H
The working one uses a VLI VL800 (I think, my photo was pretty hard to read)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Do _any_ USB 3.0 cards actually work?

2014-05-25 Thread Daniel O'Connor

On 26 May 2014, at 11:59, Daniel O'Connor docon...@gsoft.com.au wrote:
 On 25 May 2014, at 12:36, Daniel O'Connor docon...@gsoft.com.au wrote:
 I'll take pictures of them on Monday.
 
 http://imgur.com/a/N8Dto
 
 The non-working one uses an EtronTech EJ188H
 The working one uses a VLI VL800 (I think, my photo was pretty hard to read)

FWIW the Etron is pretty poorly regarded (many threads about crashes and so on).

Searching Linux shows..
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb?id=ded737fe6a2fe5d18005e6e97e40e0d728a6619b
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/host?id=001fd3826f4c736ce292315782d015f768399080
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/host?id=5cb7df2b2d3afee7638b3ef23a5bcb89c6f07bd9

Although I am not sure either are relevant to the symptoms I see.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Do _any_ USB 3.0 cards actually work?

2014-05-24 Thread Daniel O'Connor

On 25 May 2014, at 4:13, Ronald F. Guilmette r...@tristatelogic.com wrote:
 This is extraoordinarily annoying, as I spend good money to buy this
 add-in USB 3.0 card in the hopes that it would solve the problems
 that I previously had with FreeBSD and a different USB 3.0 card,
 and now it is all useless.
 
 Does FreeBSD support the VIA VL800 Chipset that this add-on card
 is alleged to contain?
 
 Does FreeBSD *ever* work with *any* USB 3.0 equipment?  Or is this
 just a far off dream?

I have 2 USB3 cards, one works and one doesn't, unfortunately I haven't been 
able to determine why as yet.

 P.S.  I know that FreeBSD doesn't have nearly as many people
 working on it as Linux does, but I didn't really expect it to
 be quite this far behind in terms of driver support for USB 3.0.
 I mean how long has USB 3.0 been out now?  Five+ years??

This isn't a helpful thing to say when you're using a volunteer project.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Do _any_ USB 3.0 cards actually work?

2014-05-24 Thread Daniel O'Connor

On 25 May 2014, at 11:34, Ronald F. Guilmette r...@tristatelogic.com wrote:
 I have 2 USB3 cards, one works and one doesn't, unfortunately I haven't
 been able to determine why as yet.
 
 What is the brand and model number of the one that works?
 
 What is the brand and model number of the one that doesn't?
 
 It would be helpful to know in both cases.

They're both generic OEM ones unfortunately so the amount of useful information 
on them is pretty small.

They show up as..

xhci0@pci0:3:0:0:   class=0x0c0330 card=0x34321106 chip=0x34321106 rev=0x03 
hdr=0x00
xhci1@pci0:5:0:0:   class=0x0c0330 card=0x70521b6f chip=0x70521b6f rev=0x00 
hdr=0x00


xhci0: XHCI (generic) USB 3.0 controller mem 0xfbeff000-0xfbef irq 17 at 
device 0.0 on pci3
xhci0: 32 byte context size.
usbus1 on xhci0

xhci1: XHCI (generic) USB 3.0 controller mem 0xfbcf8000-0xfbcf irq 17 at 
device 0.0 on pci5
xhci1: 64 byte context size.
usbus2 on xhci1

xhci0 works, xhci1 doesn't.

I'll take pictures of them on Monday.

 Also, for the one that works, are you able to connect a device to that,
 disconnect it and then reconnect it again and have it work after that?
 (I had trouble with this in the past with my other 3.0 card, even when
 only using external 2.0 devices, if I am recalling correctly.)

Yes, that works for me.

 This isn't a helpful thing to say when you're using a volunteer project.
 
 Sorry.  Having invested in two different USB 3.0 PCIe cards and a couple
 of external 3.0 enclosures... all of which I had some hope would work,
 by now, on FreeBSD... and all of which *do* in fact work entirely well
 on Linux, I do hope that perhaps my level of frustration is understandable.
 
 There are about a thousand or so different ethernet chipsets, so I can
 well and truly understand why this or that ethernet controller isn't
 supported yet.  But how many different USB chipsets are there?  Maybe
 like ten, total, including both 3.0 and 2.0?  And aren't all of these
 different USB chipsets *supposed* to present one standard programatic
 interface (to the driver) anyway?

Sure they are, but lots of corners are cut - none of the manufacturers test on 
FreeBSD, you'd be lucky if they tested on Linux. The upshot is that if it works 
on Windows then it is considered fine.

That pushes the burden onto FreeBSD developers to work out what the differences 
are and work around them. You can also bet most hardware manufacturers aren't 
going to help either.

You'll note that on the page you posted it says you must install the special 
VIA driver for the card to work - that seems to be a tacit admission that the 
hardware doesn't behave as it should hence the standard driver doesn't work.

 Anyway, ignoring the investment in MONEY I've already made... for naught,

Luckily USB3 PCI cards are pretty cheap.

FWIW this is almost exactly the situation USB2 was in - there were many 
chipsets which did not work very well at the start so for high performance 
applications like SDR (eg using Ettus USRPs) you had to be very choosy about 
which ones to use otherwise it wouldn't work.

  /pub/FreeBSD/snapshots/amd64/amd64/10.0-STABLE
 
 on one of the FreeBSD mirrors, and I haven't the vaguest idea what to do
 with that stuff in order to get it all installed onto an empty drive.
 
 If you or someone else tells me how to do that, then I will be happy to
 do so and then see if either of these 3.0 cards I have will work with
 that, and if not I'll try to help debug the problem(s).

You want an ISO from
http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/11.0/
or
http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/10.0/

although to be honest I don't believe the USB stack is substantially different 
between stable and head so there's probably not much point.

You could try gathering some debugging using usbdump and sysctl 
hw.usb.uhub.debug=15
(although deciphering it requires knowledge of how USB works and how the stack 
is written..)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 11 Apr 2014, at 16:06, Hans Petter Selasky h...@selasky.org wrote:
 On 04/11/14 06:33, Daniel O'Connor wrote:
 Also, when it does connect at 5Gbps the speed seems quite slow - on my 
 laptop (with USB controller VID 0x8086 PID 0x9c31 - Lynx point I think) I 
 get 225MB/sec using libusb. On FreeBSD I get around 92MB/sec although only 
 after lowering(!!) the amount read per transfer.
 
 FreeBSD sets an IRQ latency of 125us, while the others use the default of 
 62.5us. Are you double buffering the USB transfers? The IRQ latency can be 
 changed by editing a macro in the XHCI driver:
 
 #define XHCI_IMOD_DEFAULT   0x03E8U /* 8000 IRQ/second */
 
 At a rate of 225MB/s you need around 2x32Kbyte of buffer and you need to 
 avoid short transfers.

Interesting..

My test program looks like..
for (i = 0; i  EP_FDNREQ; i++) {
usb_xf[i].xf = libusb_alloc_transfer(0);
usb_xf[i].idx = i;
usb_xf[i].done = 0;
usb_xf[i].submitted = 0;
p = malloc(EP_FDXFAMT);

libusb_fill_bulk_transfer(usb_xf[i].xf, h, EP_UDBUS, p, EP_FDXFAMT, 
usbcb, usb_xf[i], 1);
}

I then submit all these and then have the call back log the speed (after N 
transfers) and reissue the request.
(I can send you the full code if you like)

I find that on OSX if I have..
#define EP_FDXFAMT  32768   /* Number of bytes per tranfer 
*/
#define EP_FDNREQ   4   /* Number of request to keep in 
flight */

I get 225MB/sec pretty much constantly, if I lower those values then the 
transfer rate is much lumpier.

With the same code I get 125MB/sec on FreeBSD.

I tried fiddling the numbers to get more but that seems to be the maximum.

Curiously if I increase the number of bytes per transfer to 64k the throughput 
drops to 86MB/sec.

Lowering it to 16k gives 125MB/sec, 8k gives 62MB/sec.

Finally, I ran systat -vmstat 1 while running the test and I see 4000 IRQ/sec 
on the xhci device, not 8000 as your comment above would suggest.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 11 Apr 2014, at 17:58, Hans Petter Selasky h...@selasky.org wrote:
 On 04/11/14 09:29, Daniel O'Connor wrote:
 
 On 11 Apr 2014, at 16:06, Hans Petter Selasky h...@selasky.org wrote:
 Finally, I ran systat -vmstat 1 while running the test and I see 4000 
 IRQ/sec on the xhci device, not 8000 as your comment above would suggest.
 
 Looks like a bug there. Can you try this patch:
 
 http://svnweb.freebsd.org/changeset/base/264340

That gives a definite improvement to 187MB/sec, thanks!

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 11 Apr 2014, at 19:38, Hans Petter Selasky h...@selasky.org wrote:
 On 04/11/14 09:29, Daniel O'Connor wrote:
  usb_xf[i].xf = libusb_alloc_transfer(0);
  usb_xf[i].idx = i;
  usb_xf[i].done = 0;
  usb_xf[i].submitted = 0;
 
 I think you can get more speed in libusb:

bufsize = 16384;
 
 ^^^ add a clause for super-speed to use 32K/64K here:

I think that only applies to libusb 0.1 - I am using the 1.0 API.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 11 Apr 2014, at 19:49, Daniel O'Connor docon...@gsoft.com.au wrote:
 ^^^ add a clause for super-speed to use 32K/64K here:
 
 I think that only applies to libusb 0.1 - I am using the 1.0 API.

I'm not sure if it's relevant or not but I note that with my driver being read 
by dd I get ~7500 IRQ/sec, with my libusb program I get 8000.

That is somewhat counter to what I expect.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 11 Apr 2014, at 23:43, Hans Petter Selasky h...@selasky.org wrote:
 Try this patch. I'm pretty sure you can get +256
 MByte/second using LibUSB too.
 
 http://svnweb.freebsd.org/changeset/base/264344

Unfortunately it doesn't seem to have a no impact on performance - I still get 
187MB/sec.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB 3 devices not reliably connecting at 5Gbps

2014-04-11 Thread Daniel O'Connor

On 12 Apr 2014, at 0:08, Hans Petter Selasky h...@selasky.org wrote:
 Can you check using ldd, that it is using the libusb you installed?

 Also check using usbdump what size the kernel is submitting when you are 
 using libusb.

Oops, I just realised I didn't update my program to increase the request size!

I changed it to do 32k requests and now it 225MB/sec - very nice :)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2014-03-20 Thread Daniel O'Connor

On 20 Mar 2014, at 15:20, Daniel O'Connor docon...@gsoft.com.au wrote:
 On 20 Mar 2014, at 15:10, Daniel O'Connor docon...@gsoft.com.au wrote:
 #8  0x8070f932 in usb_ioctl (dev=value optimized out, 
 cmd=3222040644, addr=0xfe011fab8270 \001, fflag=value optimized out, 
 td=value optimized out)
   at /local0/src/sys/dev/usb/usb_dev.c:1075
 
 Sigh, I just realised this means my driver was still using f_ioctl, not 
 f_ioctl_post.
 
 Sorry, will double check that and test again.

OK, I have checked and it is definitely using the _post version - it gets stuck 
in..

#0  sched_switch (td=0xfe0008f1c490, newtd=0xfe0002953490, flags=value 
optimized out) at /local0/src/sys/kern/sched_ule.c:1904
#1  0x8089e5b0 in mi_switch (flags=260, newtd=0x0) at 
/local0/src/sys/kern/kern_synch.c:485
#2  0x808d5274 in sleepq_wait (wchan=0xfe000817c050, pri=0) at 
/local0/src/sys/kern/subr_sleepqueue.c:618
#3  0x8089d916 in _sx_xlock_hard (sx=0xfe000817c050, 
tid=18446741874836358288, opts=value optimized out, file=value optimized 
out,
line=value optimized out) at /local0/src/sys/kern/kern_sx.c:678
#4  0x8089de06 in _sx_xlock (sx=0xfe000817c050, opts=0, 
file=0x80e4d528 /local0/src/sys/dev/usb/usb_device.c, line=2651) at 
sx.h:161
#5  0x8071245a in usbd_enum_lock (udev=0xfe000817c000) at 
/local0/src/sys/dev/usb/usb_device.c:2651
#6  0x8070f47a in usb_ref_device (cpd=0xfe004f287a80, 
crd=0xff812c284970, need_uref=1) at /local0/src/sys/dev/usb/usb_dev.c:225
#7  0x8070fa32 in usb_ioctl (dev=value optimized out, cmd=3225710660, 
addr=0xfe004eddfd00 \004, fflag=value optimized out, td=value 
optimized out)
at /local0/src/sys/dev/usb/usb_dev.c:1105
#8  0x8078f01a in devfs_ioctl_f (fp=0xfe01109f40a0, com=3225710660, 
data=value optimized out, cred=value optimized out, td=0xfe0008f1c490)
at /local0/src/sys/fs/devfs/devfs_vnops.c:758
#9  0x808df946 in kern_ioctl (td=0xfe0008f1c490, fd=3, 
com=3225710660, data=0xfe004eddfd00 \004) at file.h:311
#10 0x808dfb5d in sys_ioctl (td=0xfe0008f1c490, 
uap=0xff812c284b70) at /local0/src/sys/kern/sys_generic.c:696
#11 0x80c4ee58 in amd64_syscall (td=0xfe0008f1c490, traced=0) at 
subr_syscall.c:135
#12 0x80c3aa67 in Xfast_syscall () at 
/local0/src/sys/amd64/amd64/exception.S:391
#13 0x0008010d8d9c in ?? ()

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2014-03-19 Thread Daniel O'Connor

On 10 Oct 2013, at 18:18, Hans Petter Selasky h...@bitfrost.no wrote:
 On 10/10/13 09:38, Daniel O'Connor wrote:
 
 On 10/10/2013, at 16:59, Hans Petter Selasky h...@bitfrost.no wrote:
 The usb_fifo_* code handles all wakeups so I am not sure.
 
 The usb_fifo code only will only do refcounting. If you do USB control 
 requests, you should use the f_ioctl_post, callback, because the f_ioctl 
 callback does not protect against attach and detach or the enumeration thread 
 running.
 
err = (f-methods-f_ioctl) (f, cmd, addr, fflags);
 
DPRINTFN(2, f_ioctl cmd 0x%lx = %d\n, cmd, err);
 
if (err != ENOIOCTL)
goto done;
 
if (usb_usb_ref_device(cpd, refs)) {
err = ENXIO;
goto done;
}
 
err = (f-methods-f_ioctl_post) (f, cmd, addr, fflags);
 
DPRINTFN(2, f_ioctl_post cmd 0x%lx = %d\n, cmd, err);

After a long hiatus I have come back to this problem.

I updated a test system to 9-STABLE (r263062) and the problem occurs quite 
often. I'm still trying to find _why_ my device disconnects (unfortunately it 
has no debugger so it's tricky), however with this kernel is very reliably 
hangs (under and hour of tests).

I end up with the following backtrace of the thread in question..
(kgdb) bt
#0  sched_switch (td=0xfe011fa9c000, newtd=0xfe0002953000, flags=value 
optimized out) at /local0/src/sys/kern/sched_ule.c:1904
#1  0x8089e5b0 in mi_switch (flags=260, newtd=0x0) at 
/local0/src/sys/kern/kern_synch.c:485
#2  0x808d5274 in sleepq_wait (wchan=0xfe011faed050, pri=0) at 
/local0/src/sys/kern/subr_sleepqueue.c:618
#3  0x8089d916 in _sx_xlock_hard (sx=0xfe011faed050, 
tid=18446741879512481792, opts=value optimized out, file=value optimized 
out,
line=value optimized out) at /local0/src/sys/kern/kern_sx.c:678
#4  0x8089de06 in _sx_xlock (sx=0xfe011faed050, opts=0, 
file=0x80e4d528 /local0/src/sys/dev/usb/usb_device.c, line=2651) at 
sx.h:161
#5  0x8071245a in usbd_enum_lock (udev=0xfe011faed000) at 
/local0/src/sys/dev/usb/usb_device.c:2651
#6  0x807207a2 in usbd_do_request_flags (udev=0xfe011faed000, 
mtx=0x0, req=0xff812c402920, data=0xfe011fab8274, flags=4, actlen=0x0, 
timeout=5000)
at /local0/src/sys/dev/usb/usb_request.c:459
#7  0x81c6493c in ugsio_udioctl (fifo=value optimized out, 
cmd=3222040644, data=0xfe011fab8270, fflags=value optimized out) at 
ugsio.c:1038
#8  0x8070f932 in usb_ioctl (dev=value optimized out, cmd=3222040644, 
addr=0xfe011fab8270 \001, fflag=value optimized out, td=value 
optimized out)
at /local0/src/sys/dev/usb/usb_dev.c:1075
#9  0x8078f01a in devfs_ioctl_f (fp=0xfe0008f21be0, com=3222040644, 
data=value optimized out, cred=value optimized out, td=0xfe011fa9c000)
at /local0/src/sys/fs/devfs/devfs_vnops.c:758
#10 0x808df946 in kern_ioctl (td=0xfe011fa9c000, fd=3, 
com=3222040644, data=0xfe011fab8270 \001) at file.h:311
#11 0x808dfb5d in sys_ioctl (td=0xfe011fa9c000, 
uap=0xff812c402b70) at /local0/src/sys/kern/sys_generic.c:696
#12 0x80c4ee58 in amd64_syscall (td=0xfe011fa9c000, traced=0) at 
subr_syscall.c:135
#13 0x80c3aa67 in Xfast_syscall () at 
/local0/src/sys/amd64/amd64/exception.S:391
#14 0x0008010e7d9c in ?? ()

and the code at frame 7
1033usbreq.bRequest = VC_CMD;
1034USETW(usbreq.wValue, vccmd-value);
1035USETW(usbreq.wIndex, vccmd-index);
1036USETW(usbreq.wLength, sizeof(vccmd-data));
1037
1038if ((err = usbd_do_request_flags(udev, NULL, usbreq, vccmd-data, 
USB_SHORT_XFER_OK, NULL, 2)) != USB_ERR_NORMAL_COMPLETION) {
1039DPRINTFN(1, USB request failed: %d\n, err);
1040return(err);
1041}
1042

The lock object looks like..
(kgdb) print sx
$1 = (struct sx *) 0xfe011faed050
(kgdb) print *sx
$2 = {lock_object = {lo_name = 0x80e4d3d7 USB config SX lock, 
lo_flags = 41091072, lo_data = 0, lo_witness = 0x0}, sx_lock = 
18446741874768565396}

I tried 'show alllocks' in DDB but it doesn't list anything even though witness 
is in the kernel :(

However some digging shows most of the USB process threads look the same except 
for..

* 42 Thread 100030 (PID=15: usb/usbus0)  sched_switch (td=0xfe0004e75490, 
newtd=0xfe0002953000, flags=value optimized out)
at /local0/src/sys/kern/sched_ule.c:1904
#0  sched_switch (td=0xfe0004e75490, newtd=0xfe0002953000, flags=value 
optimized out) at /local0/src/sys/kern/sched_ule.c:1904
#1  0x8089e5b0 in mi_switch (flags=260, newtd=0x0) at 
/local0/src/sys/kern/kern_synch.c:485
#2  0x808d5274 in sleepq_wait (wchan=0xfe000851a288, pri=0) at 
/local0/src/sys/kern/subr_sleepqueue.c:618
#3  0x80852c6d in _cv_wait (cvp=0xfe000851a288, 
lock=0x81403700) at /local0/src/sys/kern/kern_condvar.c:139
#4

Re: USB config SX lock deadlock

2014-03-19 Thread Daniel O'Connor

On 20 Mar 2014, at 15:10, Daniel O'Connor docon...@gsoft.com.au wrote:
 #8  0x8070f932 in usb_ioctl (dev=value optimized out, 
 cmd=3222040644, addr=0xfe011fab8270 \001, fflag=value optimized out, 
 td=value optimized out)
at /local0/src/sys/dev/usb/usb_dev.c:1075

Sigh, I just realised this means my driver was still using f_ioctl, not 
f_ioctl_post.

Sorry, will double check that and test again.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2013-10-10 Thread Daniel O'Connor

On 10/10/2013, at 16:59, Hans Petter Selasky h...@bitfrost.no wrote:
 It might under some circumstances but not directly.
 
 It has 3 sub interfaces, if there is an error on one the the DAQ program 
 will call abort() which would result in FDs being closed.
 
 However that sub interface does not use read/poll only ioctl.
 
 How do these IOCTLs work?

They get turned into UT_READ_VENDOR_DEVICE requests in the driver.

 Do you wakeup any sleepers at surprise detach?


The usb_fifo_* code handles all wakeups so I am not sure.

Generally speaking the DAQ program sees these as IO errors and will then call 
abort() because the original code was for a PCI device and so it assumed the 
device could never disappear.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2013-10-10 Thread Daniel O'Connor

On 10/10/2013, at 18:18, Hans Petter Selasky h...@bitfrost.no wrote:
 If you use synchronous USB control requests, then those should always error 
 out.

Yes it is synchronous (uses usbd_do_request_flags).

 The usb_fifo_* code handles all wakeups so I am not sure.
 
 The usb_fifo code only will only do refcounting. If you do USB control 
 requests, you should use the f_ioctl_post, callback, because the f_ioctl 
 callback does not protect against attach and detach or the enumeration thread 
 running.

Sorry, I misspoke earlier :(

The usb_fifo code is only used for the RS485 and high speed data bus, the other 
(low speed configuration bus) is done using ioctl - 
usbd_do_request(UT_*_VENDOR_DEVICE).

I will see about cranking up the debug level and trying to provoke a failure on 
the bench.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


USB config SX lock deadlock

2013-10-09 Thread Daniel O'Connor
Hi,
We have a custom Cypress FX2 based data acquisition card connected to a FreeBSD 
9.2 system. 

Today the device disconnected
Oct  9 03:24:11 juskym kernel: ugsio0: at uhub3, port 1, addr 3 (disconnected)

and then some time later we noticed the data acquisition process was stuck in 
'USB config SX lock' (and un-killable). I ran usbconfig and it also got stuck 
in the same wchan.

I tried rebooting it and got stuck with this on the screen..
usbus0: Controller shutdown complete
usbus1: Controller shutdown 

I have previously run the same hardware on 9.0 (where there was a panic in 
devfs triggered if the DAQ card disconncted sometimes) and 9.1 (where I have 
not seen any problems).

Does anyone have an idea about how I could go about gathering more information 
if it happens again?

Thanks.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2013-10-09 Thread Daniel O'Connor

On 09/10/2013, at 20:59, Hans Petter Selasky h...@bitfrost.no wrote:
 I have previously run the same hardware on 9.0 (where there was a panic in 
 devfs triggered if the DAQ card disconncted sometimes) and 9.1 (where I have 
 not seen any problems).
 
 Does anyone have an idea about how I could go about gathering more 
 information if it happens again?
 
 It is not a deadlock. It is just that the reference in /dev/cuaUX does not go 
 away. Have you tried 9-stable?


It is actually running r253505, sorry I should have mentioned that before.

It isn't a serial device, although the driver is a thin wrapper around the 
usb_fifo code (which is very useful - thanks :)

 There are also some sysctls you can set, see hw.usb to change the shutdown 
 behaviour.

This would be hw.usb.no_shutdown_wait ?

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: USB config SX lock deadlock

2013-10-09 Thread Daniel O'Connor

On 09/10/2013, at 22:43, Hans Petter Selasky h...@bitfrost.no wrote:
 On 10/09/13 12:38, Daniel O'Connor wrote:
 On 09/10/2013, at 20:59, Hans Petter Selasky h...@bitfrost.no wrote:
 It is actually running r253505, sorry I should have mentioned that before.
 
 It isn't a serial device, although the driver is a thin wrapper around the 
 usb_fifo code (which is very useful - thanks :)
 
 Does your application close the file handle when it gets a read/poll error?


It might under some circumstances but not directly. 

It has 3 sub interfaces, if there is an error on one the the DAQ program will 
call abort() which would result in FDs being closed.

However that sub interface does not use read/poll only ioctl.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C








signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: the usb port is not providing enough juice

2012-06-11 Thread Daniel O'Connor

On 11/06/2012, at 22:52, Daniel Braniss wrote:
 I can't charge iPad using my FreeBD desctop, iPhone/iPod is ok.
 under Linux there is a patch that does some 'magic',
 so I was wondering if we have something similar for FreeBSD.

Some googling shows..
/usr/ports/sysutils/ipad_charge

(which looks like it tells the ipad to draw more current, not to enable magic 
bits in the port to supply it so YMMV with various USB hardware)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: Is there a facility to send USB requests through the script?

2012-04-21 Thread Daniel O'Connor

On 22/04/2012, at 14:34, Yuri wrote:
 I am looking at the USB webcam device that doesn't work on BSD (stalls).
 I have the log of linux USB communcation to the same device, where it works 
 fine.
 
 Is there a way I can send the particular requests to USB device through 
 script, as a debugging facility, so that I can easily change what is sent, 
 compare what is received to what I have in log, and make changes?


AFAIK there are no shell commands for this, however you can get libusb bindings 
for Python, Ruby, etc..

 I know that kernel also sends some requests to the USB device, and I would 
 like to disable this in such case.

If there is no driver then the kernel will only enumerate it which is the bare 
minimum to give it an address and read out the configuration descriptors.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: [Freebsd 9] [amd64] [USB] [HPLIP] what's the (new) right way to manage hplip usb-plugged printers, running Freebsd 9

2011-10-29 Thread Daniel O'Connor

On 30/10/2011, at 24:40, David Marec wrote:
 But, now running FreeBSD 9, I get new usb/devd behavior issues.
 
 First, the ulpt module is always loaded. Is there any elegant way to get rid 
 of this 'self loading' behavior, except to remove it from /boot/modules ?
 Anyway, it sounds like HPLIP is now working with the ulpt module loaded.

I'm not sure what would load it automatically - it may be built into the kernel 
though. Anyway, as you say it should work with ulpt loaded anyway.

 But, devd never sets the suitable rights on ugen.
 
 Moreover, switching to the  'action' that only logs something, reveals that 
 devd never executes this entry.
 
 
 So, what's should be the news groupuser's rights required by HPLIP/cups on 
 FreeBSD 9 ?
 
 And, how to handle them with devd ?

I have a similar problem..

Looking at /etc/devd/uath.conf I see..
notify 100 {
match system  USB;
match subsystem   DEVICE;
match typeATTACH;
match vendor  0x168c;
match product 0x0002;
action /usr/sbin/uathload -d /dev/$cdev;
};

Also, I have devd entries for NUT (UPS software) which look like so..
attach 100 {
match vendor  0x0463;
match product 0x;
action chown :uucp /dev/$device-name; chmod 660 /dev/$device-name;
};

However this doesn't seem to work anymore, it certainly used to.. :(

I tried adding the system, subsystem  type parts and changing device-name to 
cdev but no luck..

I ran devd -Dd and checked the output but while it says it parses nut.conf it 
doesn't seem to match the entries.

devd output looks like so..

Processing event '!system=USB subsystem=DEVICE type=ATTACH ugen=ugen1.3 
cdev=ugen1.3 vendor=0x046
3 product=0x devclass=0x00 devsubclass=0x00 sernum=0 
release=0x4241 mode=host port=
3 parent=ugen1.1'
Pushing table
setting system=USB
setting subsystem=DEVICE
setting type=ATTACH
setting ugen=ugen1.3
setting cdev=ugen1.3
setting vendor=0x0463
setting product=0x
setting devclass=0x00
setting devsubclass=0x00
setting sernum=0
setting release=0x4241
setting mode=host
setting port=3
setting parent=ugen1.1
Processing notify event

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: USB 3.0 Expresscard

2011-09-19 Thread Daniel O'Connor

On 19/09/2011, at 23:16, CDP wrote:
 is there any known USB 3.0 Expresscard compatible with FreeBSD ?

I don't know and haven't tried one, but I would guess/hope that they should 
Just Work (™) so long as you have xhci loaded.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: Connecting Nokia C2 cell phone

2011-08-26 Thread Daniel O'Connor

On 27/08/2011, at 3:14, Jens Jahnke wrote:
 I just plugged my nokia c2 cell phone into my usb port an got the
 following output in messages:
 
 Aug 26 19:42:04 magni kernel: ugen4.2: Nokia at usbus4
 Aug 26 19:42:05 magni root: Unknown USB device: vendor 0x0421 product
 0x054d bus uhub4
 
 Has anyone successfully connected such a phone to his bsd box?

You could look at Gnokii (http://www.gnokii.org/) although the last time I used 
it was when 2G data and RS232 was the in thing.. There is a port (comms/gnokii)

 
 Regards,
 
 Jens
 
 -- 
 26. Ernting 2011, 19:42
 Homepage : http://www.jan0sch.de
 
 LIFE:
   A whim of several billion cells to be you for a while.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: FreeBSD 8.2 and DisplayLink devices?

2011-07-11 Thread Daniel O'Connor

On 11/07/2011, at 17:35, Chris Rees wrote:
 It would be nice if FreeBSD shipped with those files in (say) 
 /usr/libdata/pkgconfig and the pkg-config port was tweaked to search there 
 as well but it hasn't happened yet..
 
 Really? We don't have pkgconfig in the base system, so I'd submit that
 it'd be a little strange.
 
 I would suggest a port (perhaps like libusb-pkgconfig) that
 installs/creates those files in ${PREFIX}/libdata/pkgconfig for you,
 or any other creative fix that you can think of!
 
 Not sure if we want to go down that road though...

That is the other approach but it's a bit of a pain to make the libusb port do 
something very different for 8.x.

(Or at least I don't have any patches for that :)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: FreeBSD 8.2 and DisplayLink devices?

2011-07-11 Thread Daniel O'Connor

On 12/07/2011, at 24:06, Chris Rees wrote:
  That is the other approach but it's a bit of a pain to make the libusb port 
  do something very different for 8.x.
 
 
 The last thing we should have is a port that does different things depending 
 on OS version like that, I was thinking of a virtual port, as it were.

I don't believe that is currently possible.

Although I suppose you could have magic in bsd.ports.mk which looked for 
USE_LIBUSB= or something..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: FreeBSD 8.2 and DisplayLink devices?

2011-07-10 Thread Daniel O'Connor

On 11/07/2011, at 7:59, Torfinn Ingolfsen wrote:

 On Sun, 10 Jul 2011 20:13:17 +0200
 Matthias Apitz g...@unixarea.de wrote:
 
 
 CFLAGS='-I/usr/local/include' CPPFLAGS='-I/usr/local/include' 
 LDFLAGS='-L/usr/local/lib '  ./configure
 
 
 Same error as before. Also tried
 env CFLAGS='-I/usr/local/include' CPPFLAGS='-I/usr/local/include' 
 LDFLAGS='-L/usr/local/lib '  ./configure
 
 it didn't make a difference - same error as before.

It's probably using pkg-config and FreeBSD doesn't ship with a .pc file for 
libusb.

Create files like so
[midget 12:51] ~ cat /usr/local/libdata/pkgconfig/libusb.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}

[midget 12:51] ~ cat /usr/local/libdata/pkgconfig/libusb-1.0.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 1.0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}



and try it again.

It would be nice if FreeBSD shipped with those files in (say) 
/usr/libdata/pkgconfig and the pkg-config port was tweaked to search there as 
well but it hasn't happened yet..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: LabJack with FreeBSD?

2011-06-03 Thread Daniel O'Connor

On 03/06/2011, at 11:46, Thomas wrote:
 Has someone ever tried to run LabJack U3 with FreeBSD?
 
 http://labjack.com/u3
 
 Labjack offers a combined OSX and Linux driver. It supports libusb.
 Maybe it could work with freebsd too.

Have you tried building it on FreeBSD?

I would expect it to compile with minimal changes, although it may complain you 
don't have libusb installed depending on how it detects it.

If it uses pkg-config you can put the following in 
/usr/local/libdata/pkgconfig/libusb.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}

and this in /usr/local/libdata/pkgconfig/libusb-1.0.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 1.0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}

(I am assuming you're running 8.x or higher).

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: USB driver locking

2011-05-25 Thread Daniel O'Connor

On 25/05/2011, at 9:33, Hans Petter Selasky wrote:
 On Tuesday 24 May 2011 23:48:30 Daniel O'Connor wrote:
 I find that my application has rare problems where it does not get a reply
 from the micro to a control bus packet, or perhaps the micro doesn't
 receive it (I need to add a sequence number or similar to my protocol to
 try and detect it I think).
 
 There was a data toggle issue fixed with the EHCI recently, which triggers 
 depending on hardware timing. Are you running the latest 8-stable or 9-

This one?
http://svnweb.freebsd.org/base?view=revisionrevision=219845

I have that as I am running 219926

 current. There is also a new utility called usbdump, which can be used to 
 figure out what is going on.

I am running 9-current (in production for my sins..)

usbdump is useful but consumes too much CPU at my data rate :(

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: USB driver locking

2011-05-25 Thread Daniel O'Connor

On 25/05/2011, at 9:51, Hans Petter Selasky wrote:
 current. There is also a new utility called usbdump, which can be used to
 figure out what is going on.
 
 I am running 9-current (in production for my sins..)
 
 usbdump is useful but consumes too much CPU at my data rate :(
 
 You probably need an USB analyzer to figure out the real problem. Have you 
 tried to start usbdump only once the problem happens?

I'll try and cook something up to run it when the problem happens.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-02-21 Thread Daniel O'Connor

On 19/02/2011, at 1:38, Hans Petter Selasky wrote:
 Which harddisk driver are you using? ATA?

Yes.

 My guess would be that taskqueues() in the HDD drivers are using swi-queues, 
 instead of ordinary lower-priority queues. For example in sys/dev/ata I found:
 
TASK_INIT(request-task, 0, ata_completed, request);
ATA_DEBUG_RQ(request, finish taskqueue_swi);
taskqueue_enqueue(taskqueue_swi, request-task);
 
 Which should perhaps just be taskqueue_thread instead of taskqueue_swi.

I'll try changing it and seeing if it improves things.

 I've noticed during USB debugging that if certain non-DATA-xfer SCSI commands 
 take time to complete, the whole system is waiting apparently, at least X11. 
 This might indicate that synchronous code is being run from interrupt context.

Interesting.. Although in the dual core case I wouldn't have thought it would 
be a huge deal would it?

I had to give the dual core system I was using for testing back so I am 
currently using a single core with a non-ACHI capable chipset. I'll try and get 
access to the previous system again for some more testing.

Do you have any suggestions for how I can find out exactly where it's sleeping 
in libusb? Or I suppose once it's in the kernel..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb-config missing?

2011-02-06 Thread Daniel O'Connor

On 06/02/2011, at 21:41, Hans Petter Selasky wrote:
 I have..
 http://www.dons.net.au/~darius/libusb-8.diff
 
 I only did a few ports because I wasn't sure if it was the correct approach
 and it's quite tedious :)
 
 FYI: libusb in FreeBSD base depends on libpthread .

OK, easy fixed.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb-config missing?

2011-02-04 Thread Daniel O'Connor

On 07/01/2010, at 14:54, Daniel O'Connor wrote:
 One problem is that ports don't know which version to use, it would be nice 
 if they could just depend on devel/libusb and Magic Happened (tm) to pick
 the correct thing.
 
 Unfortunately that is beyond my port fu :(

I had another think about this..

What about if devel/pkgconfig is modified to search in /usr/libdata/pkgconfig 
and systems with native libusb have entries in there?
eg..
--- Makefile.orig   2011-02-05 11:55:04.546436357 +1030
+++ Makefile2011-02-05 11:50:37.055279037 +1030
@@ -25,7 +25,7 @@
 
 .include bsd.port.pre.mk
 
-PC_PATH=${PREFIX}/libdata/pkgconfig
+PC_PATH=/usr/libdata/pkgconfig:${PREFIX}/libdata/pkgconfig
 PC_PATH:=${PC_PATH}:${PREFIX}/lib/pkgconfig
 .if ${LOCALBASE} != ${PREFIX}
 PC_PATH:=  ${PC_PATH}:${LOCALBASE}/libdata/pkgconfig

Along with..
[midget 11:57] ~ cat /usr/libdata/pkgconfig/libusb-1.0.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 1.0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}

[midget 11:57] ~ cat /usr/libdata/pkgconfig/libusb.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libusb
Description: USB access library
Version: 0.1
Libs: -L${libdir} -lusb
Cflags: -I${includedir}

Ports will still need code to know 8.x+ do not require libusb but they need 
that regardless.

I'm not sure what the right way to install such files in libdata is though.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb-config missing?

2011-02-04 Thread Daniel O'Connor

On 05/02/2011, at 16:01, Peter Jeremy wrote:
 On 07/01/2010, at 14:54, Daniel O'Connor wrote:
 One problem is that ports don't know which version to use, it would be nice 
 if they could just depend on devel/libusb and Magic Happened (tm) to pick
 the correct thing.
 
 The correct solution is 'USE_LIBUSB=yes' with relevant magic in bsd.port.mk
 Unfortunately this is unlikely to occur because it's only needed for 7.x
 which will be dying within the next few years.

USE_LIBUSB= would be nice, I will see if I can author such a thing..

That said it is still desirable to have .pc files for libusb as I believe that 
is the canonical way to determine how to compile  link against it.

If that is by making USE_LIBUSB adds a dep to a pseudo port which installs the 
.pc files, or adds no dep because the .pc files are in base are pretty much 
equivalent IMO.

 What about if devel/pkgconfig is modified to search in 
 /usr/libdata/pkgconfig and systems with native libusb have entries in there?
 
 Apart from libusb, are there any other apps in the base system that
 could reasonably install .pc files?

None come to mind..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-02-03 Thread Daniel O'Connor

On 03/02/2011, at 17:52, Hans Petter Selasky wrote:
 I am trying to get it working at the moment, however I'm only finding it
 capable of 4 or 8 Mb/sec (512 or 1024 byte EP), although perhaps I don't
 understand how to do ISO transfer properly.
 
 Hi,
 
 You need to set the multiplier to 2 or 3. Then you get 3*1024 bytes at 
 maximum.

OK, so I need..
usb_xf[i].xf = libusb_alloc_transfer(3);
 p = malloc(3 * 1024);
libusb_fill_iso_transfer(usb_xf[i].xf, h, 0x82 p, 3 * 1024, 3, usbcb, 
usb_xf[i], 2000);

?

 BTW do you have a feel for the latency in bulk vs iso? I currently have
 5-10 msec of buffering in the hardware which I plan on increasing but I'm
 not sure what a reasonable amount would be :)
 
 I put a logic analyser on my board and it shows fairly regular requests
 from the hardware (16kbyte bursts every 2msec or so) however I see
 glitches occasionally - 5.5ms, 7.5ms.
 
 I am not sure if they are attributable to userland scheduling (in which
 case writing a kernel driver should help) or some subtlety in USB itself.
 
 Are you using two isochronous transfers or just one?

It is a single in endpoint. The device also has 2 in bulk and 2 out bulk 
endpoints for other data but they are idle while the iso one is running.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-02-03 Thread Daniel O'Connor

On 04/02/2011, at 14:32, Daniel O'Connor wrote:
 OK, I have that, it seems I need to work on the firmware as it's not sending 
 data properly when I set it to iso. I'll work on that and try and figure it 
 out. Unfortunately there isn't much example code on isochronous data transfer 
 with the FX2 :(
 
 However I see the requests return saying they are complete but the amount of 
 data transferred is 0. Setting the short not OK flag doesn't change the 
 behaviour.
 
 I'm not sure if this is a bug in libusb, expected behaviour, or a bug in my 
 program.

I think this might be the FX2 sending zero length packets because its FIFO is 
empty.

Now to figure out why it isn't triggering :-/

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-02-03 Thread Daniel O'Connor

On 04/02/2011, at 15:18, Daniel O'Connor wrote:
 I'm not sure if this is a bug in libusb, expected behaviour, or a bug in my 
 program.
 
 I think this might be the FX2 sending zero length packets because its FIFO is 
 empty.
 
 Now to figure out why it isn't triggering :-/

Looks like my firmware managed to confuse the device enough that a power cycle 
was required, it now transfers data.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-02-02 Thread Daniel O'Connor

On 28/01/2011, at 18:28, Hans Petter Selasky wrote:
 For this kind of applications ISOCHRONOUS transfers should be used. Then you 
 can have a double buffer guard in the range 1-56ms, regardless of the buffer 
 size the hardware uses.

That sounds nice :)
I am trying to get it working at the moment, however I'm only finding it 
capable of 4 or 8 Mb/sec (512 or 1024 byte EP), although perhaps I don't 
understand how to do ISO transfer properly.

BTW do you have a feel for the latency in bulk vs iso? I currently have 5-10 
msec of buffering in the hardware which I plan on increasing but I'm not sure 
what a reasonable amount would be :)

I put a logic analyser on my board and it shows fairly regular requests from 
the hardware (16kbyte bursts every 2msec or so) however I see glitches 
occasionally - 5.5ms, 7.5ms. 

I am not sure if they are attributable to userland scheduling (in which case 
writing a kernel driver should help) or some subtlety in USB itself.

Thanks :)
 
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-01-28 Thread Daniel O'Connor

On 28/01/2011, at 18:28, Hans Petter Selasky wrote:
 For this kind of applications ISOCHRONOUS transfers should be used. Then you 
 can have a double buffer guard in the range 1-56ms, regardless of the buffer 
 size the hardware uses.

Hmm, OK, I will have a look at changing it, although it is a bit of a pain 
because you can't stall an ISO EP and I'm using stall to indicate an error.

Is it possible to change the amount that is buffered? This is a specialised 
application so a custom kernel is no problem. Even a hint in the right 
direction would be greatly appreciated :)

 You could also try an XHCI controller, because the BULK buffering is done 
 differently there.

OK thanks, I'll try that too.

 
 I obviously don't need any more
 throughput, however my application is very sensitive to latency, as I am
 reading out of a fairly small FIFO and if it fills up my entire run has to
 be aborted.
 
 
 
 --HPS
 

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-01-27 Thread Daniel O'Connor

On 23/01/2011, at 24:03, Hans Petter Selasky wrote:
 You need to change the way you buffer the data. FreeBSD does not queue more 
 than 2 URB's at any time, and the turnaround time varies from 1ms to 125us 
 due 
 to hardware IRQ restrictions. Linux queues up all it can get, which leads to 
 other kind of problems. The current internal buffer limit is 16Kbyte 8000 
 times per second which gives a MAX of 128 MByte/second.

How difficult would it be to increase this? I obviously don't need any more 
throughput, however my application is very sensitive to latency, as I am 
reading out of a fairly small FIFO and if it fills up my entire run has to be 
aborted.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: System lockups caused by USB external HDD

2011-01-23 Thread Daniel O'Connor

On 24/01/2011, at 9:10, CDP wrote:
 g_vfs_done():da0s2[WRITE(offset=, length=16384)]error = 5
 [several more lines similar to the above]
 panic: softdep_move_dependencies: need merge code
 cpuid = 0
 KDB: stack backtrace:
 #0 0x... at kdb_backtrace+0x5e
 #1 0x... at panic+0x182

It looks like the disk is dying, or the FS is corrupt (the former might cause 
the later).

Can you run smartctl on the disk? Unfortunately a lot of enclosures reject 
SMART commands so you might not be able to :(

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: libusb performance on 8.1

2011-01-22 Thread Daniel O'Connor

On 23/01/2011, at 24:03, Hans Petter Selasky wrote:
 While doing some speed testing I find that FreeBSD does ~4Mb/sec, but Linux
 does 17Mb/sec  OS X does 8-10Mb/sec.
 
 You need to change the way you buffer the data. FreeBSD does not queue more 
 than 2 URB's at any time, and the turnaround time varies from 1ms to 125us 
 due 
 to hardware IRQ restrictions. Linux queues up all it can get, which leads to 
 other kind of problems. The current internal buffer limit is 16Kbyte 8000 
 times per second which gives a MAX of 128 MByte/second.
 
 In general during hardware design:
 
 1) Avoid short packets.
 2) Make sure transfer buffers are matched between host and device.
 
 From my experience it is very possible to reach +30Mbyte/second with LibUSB 
 under FreeBSD 8.2+, given the buffering is optimal for the kernel.
 

Hmm... I am transferring fixed size packets of 512 bytes, so there shouldn't be 
any short packets (unless I misunderstand what you mean).

Ahh, I I see what you mean now.. I was transferring a single packet at a time 
because I didn't realise you could transfer more at once.

If I switch to transferring 2k at once it goes up to 16Mb/sec.

Thanks :)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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


libusb performance on 8.1

2011-01-19 Thread Daniel O'Connor
[re-sent from the correct address]

Hi,
I am building a USB interface to a radar data acquisition chassis based on the 
Cypress CY7C68013A.

While doing some speed testing I find that FreeBSD does ~4Mb/sec, but Linux 
does 17Mb/sec  OS X does 8-10Mb/sec.

It is using libusb-1.0 with the async API in a threaded app. I spawn a thread 
which sites in the following loop:

   while (!child_exit) {
tout.tv_sec = 0;
tout.tv_usec = 10;
libusb_handle_events_timeout(ctx, tout);
   }
   ugsio_cancelusb();

The parent thread is the rest of the program which and handles reading data out 
of the completed transfers and forwarding them to the data processing children 
and re-submitting them to the USB stack.

I keep 8 transactions of 512 bytes each in flight. The device itself holds up 
to 4 packets in a FIFO until the PC is ready. Increasing the number of 
transactions in flight has no effect on performance.

Does anyone have a suggestion as to how I can look at improving performance? 
Deploying Linux is not really an option :)

The Linux PC is..
Linux fpgawork 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 2011 
x86_64 GNU/Linux
The CPU is a Core 2 E6400 @ 2.13GHz on a Gigabyte 965P-DS3 rev 1 
(http://www.gigabyte.com/products/product-page.aspx?pid=2314#ov) which has an 
ICH8 chipset.

The FreeBSD PC is..
FreeBSD aumond8.gsoft.com.au 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 
02:55:53 UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
 i386
The CPU is a Core 2 E7500 @ 2.93GHz on a Supermicro C2SBA+ 
(http://www.supermicro.com/products/motherboard/Core/G33/C2SBA_.cfm) which has 
an ICH9 chipset.

Any patches welcome!

Thanks.
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: usb_interrupt_read blocks forever sometimes

2010-02-10 Thread Daniel O'Connor
On Wed, 10 Feb 2010, Hans Petter Selasky wrote:
 I would not recommend using signals with libusb. It is not portable.
 Currently signals are ignored. What you would have to do, is to use

OK.

 the timeout argument which you are doing, and have a timekeeper
 variable somewhere, or create another thread. Still, when using the
 timeout there is a chance you can loose data.

The problem is that the timeout seems to be ignored sometimes - that is 
the only reason I was playing with alarm() at all.

I have the timeout set to 100 (milliseconds?) yet I find if I restart 
the program every now and then it will get stuck on the first read.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: usb_interrupt_read blocks forever sometimes

2010-02-10 Thread Daniel O'Connor
On Wed, 10 Feb 2010, Hans Petter Selasky wrote:
  I have the timeout set to 100 (milliseconds?) yet I find if I
  restart the program every now and then it will get stuck on the
  first read.

 Could you enable debugging for the Host Controller responsible for
 your device:

 sysctl hw.ehci.debug=15
 sysctl hw.ohci.debug=15
 sysctl hw.uhci.debug=15

OK the log is a bit big so I've put it at..
http://www.dons.net.au/~darius/wh1080-debug.txt.gz

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


usb_interrupt_read blocks forever sometimes

2010-02-09 Thread Daniel O'Connor
I am trying to talk to my WH1080 weather station and I find that 
sometimes when I start the program it will stall forever in 
usb_interrupt_read even though the timeout specified is 50 milliseconds.

I also tried using alarm() but that doesn't cause the transfer to abort 
(it appears the libusb code loops and doesn't check for EINTR).

The code in question is..
signal(SIGALRM, alarmhandler);
alarm(1);

do {
if ((bytes_read = usb_interrupt_read (station,
  USB_ENDPOINT_IN | USB_RECIP_INTERFACE,
  buf,
  8,
  100 )) == 8 ){
  if (i  0)
fprintf(stderr, Read OK after %d tries\n, i + 1);
  return bytes_read;
}
if (errno == EINTR)
  fprintf(stderr, Alarmed\n);
  
fprintf(stderr, Retrying..\n);

if (errno == EAGAIN)
  usleep (1);
i++;
  }
  while (errno != EINTR  i  MAXTRIES);
...
(Then stuff printing out if we get EINTR etc)

The general procedure is to issue a request on the control endpoint and
then read the result via the interrupt end point in 8 byte pieces.

The retry stuff is there because I was having issues with reliable reads.

The alarm handler doesn't seem to get called sometimes, maybe one in 10
starts causes usb_interrupt_read to hang in..
(gdb) bt
#0  0x000800a8086c in poll () from /lib/libc.so.7
#1  0x00080077531d in libusb20_dev_wait_process (pdev=0x7fffe870, 
timeout=1) 
at /usr/src/lib/libusb/libusb20.c:979
#2  0x00080076f78c in usb_std_io (dev=0x801044d00, ep=Variable ep is not 
available.
) at /usr/src/lib/libusb/libusb20_compat01.c:598
#3  0x0040180d in read_station (buf=0x5048d0 \036 \0040\021) 
at wh1080.c:249

Other starts I find it fails 10 times, retries the control message and
works fine - I figure the micro has issues missing requests.

The missing SIGALRM seems much worse though - how can it be masked? Of
course if usb_interrupt_read honored its timeout that wouldn't matter :)

The device reports as..
ugen0.5: product 0x8021 vendor 0x1941 at usbus0, cfg=0 md=HOST spd=LOW 
(1.5Mbps) pwr=ON


 Configuration index 0

bLength = 0x0009
bDescriptorType = 0x0002
wTotalLength = 0x0022
bNumInterfaces = 0x0001
bConfigurationValue = 0x0001
iConfiguration = 0x  no string
bmAttributes = 0x0080
bMaxPower = 0x0032

Interface 0
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x
  bAlternateSetting = 0x
  bNumEndpoints = 0x0001
  bInterfaceClass = 0x0003
  bInterfaceSubClass = 0x
  bInterfaceProtocol = 0x
  iInterface = 0x  no string

  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x21
  bDescriptorSubType = 0x00
   RAW dump:
   0x00 | 0x09, 0x21, 0x00, 0x01, 0x00, 0x01, 0x22, 0x34,
   0x08 | 0x00

 Endpoint 0
bLength = 0x0007
bDescriptorType = 0x0005
bEndpointAddress = 0x0081  IN
bmAttributes = 0x0003  INTERRUPT
wMaxPacketSize = 0x0008
bInterval = 0x000a
bRefresh = 0x
bSynchAddress = 0x



Any help appreciated, thanks!

PS please CC me.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2010-02-04 Thread Daniel O'Connor
On Thu, 29 Oct 2009, Hans Petter Selasky wrote:
 The libUSB device pointer usage in sane needs to be audited. Probably
 it is best to figure out where the following functions are called:

  usb_find_busses() usb_find_devices() usb_device()
      usb_get_busses()

 And carefully check how the libusb device handle pointers are
 updated.

I wasn't really up to that unfortunately :(
I had a look and I couldn't see it free anything, but I am not 100% sure 
how the libusb stuff works internally. I note that the pdev does not 
appear free'd but uninitialised.

However I did notice that SANE has 1.0 API support and using that does 
not trigger this problem.

Now to convince configure to pick it up by default :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


sysutils/nut and an MGE Ellipse 1000 UPS

2010-01-27 Thread Daniel O'Connor
Hi,
I have an MGE UPS connected via USB and I am having trouble getting it 
to work.

I am trying the latest SVN trunk from the NUTdevs but I find it doesn't 
enumerate everything from the UPS properly, eg

[midget 21:10] ~/projects/nut-trunk sudo /usr/local/libexec/nut/usbhid-ups -D 
-D -D -a mge
   6.238605 Path: UPS.PowerSummary.PresentStatus.Discharging, Type: 
Feature, ReportID: 0x01, Offset: 2, 
Size: 1, Value: 0.00
   6.238627 Report[buf]: (2 bytes) = 01 13
   6.238647 Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, 
ReportID: 0x01, Offset: 1, Size: 
1, Value: 1.00
   6.238669 Report[buf]: (2 bytes) = 01 13
   6.238676 Path: 
UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, 
ReportID: 
0x01, Offset: 3, Size: 1, Value: 0.00
   6.240481 libusb_get_report: Unknown error
   6.240646 Can't retrieve Report 02: Input/output error
   6.240658 Can't initialize data from HID UPS

or..
   2.489542 Report[get]: (2 bytes) = 08 1e
   2.489564 Path: UPS.PowerSummary.RemainingCapacityLimit, Type: Feature, 
ReportID: 0x08, Offset: 0, Size: 
8, Value: 30.00
   2.491554 libusb_get_report: Unknown error
   2.491662 Can't retrieve Report 09: Input/output error
   2.491671 Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, 
ReportID: 0x09, Offset: 0, Size: 32
   5.530483 libusb_get_report: Unknown error
   5.530576 Can't retrieve Report 0a: Input/output error
   5.530586 Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, 
ReportID: 0x0a, Offset: 0, Size: 32
  10.417508 libusb_get_report: Unknown error
  10.417603 Can't retrieve Report 0c: Input/output error

 or..
  20.865729 Quick update...
  20.867648 libusb_get_report: Unknown error
  20.867744 Can't retrieve Report 0a: Input/output error
  22.618705 upsdrv_updateinfo...
  22.618729 Got to reconnect!

Sometimes it seems to work for a while, other times it won't even get the 
initial descriptor.

I tried setting LIBUSB_DEBUG but it didn't seem to produce any output.

I find that if I set 'pollonly' (ie disable interrupt pipe) it works
considerably better but still glitches not infrequently. (ie upsc reports 
stale data)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: libusb-config missing?

2009-12-25 Thread Daniel O'Connor
On Fri, 25 Dec 2009, Hans Petter Selasky wrote:
 On Friday 25 December 2009 02:07:42 Daniel O'Connor wrote:
  Would it be possible to create a libusb-config shell script and
  install it in /usr/bin?

 I guess if other generic FreeBSD libraries don't do this, it will be
 hard I guess.

That is true but I think this is a special case as libusb is widely 
regarded as an external library by software devs.

 You mean that we create a .pc file for libusb ?

Hmm, I meant the libusb-config shell script but I guess the .pc file 
would be necessary too :(

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


libusb-config missing?

2009-12-24 Thread Daniel O'Connor
Would it be possible to create a libusb-config shell script and install 
it in /usr/bin?

libusb from ports installed such a script and it is the standard way to 
find libusb and know how to call it.

I suspect that adding it would also reduce patches for a lot of ports 
(and this makes it easier when you are trying stuff direct from the 
maintainer as you don't need a local patch)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: Re-enumerating a device

2009-12-16 Thread Daniel O'Connor
On Wed, 16 Dec 2009, Hans Petter Selasky wrote:
  It takes about a second to run though..

 Could you also check the number of configurations ?

 usbconfig -u 0 -a 2 reset

 usbconfig -u 0 -a 2 dump_device_desc dump_curr_config_desc

Sigh, I dunno what I was doing wrong before but now it works!
[inchoate 10:59] ~ sudo dfu-util -D ~/ma004103.bin -t 256 -R
dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Opening USB Device 0x:0x...
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x0763:0x2804] devnum=0, cfg=0, intf=0, alt=0, name=RAM
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0100
bytes_per_hash=120
Starting download: [##] 
finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
can't detach: Unknown error
Resetting USB to switch back to runtime mode

 Seems like your device is broken then. Does the same procedure work
 on Linux?

I think it works in Linux, it definitely does in Windows.

It uses a Ti TAS1020A (http://www.ti.com/lit/gpn/tas1020a) connected to an
AK4532VF (http://www.asahi-kasei.co.jp/akm/en/product/ak4532/ak4532.html)

Interestingly it does have a 24LC64 (64kbit I2C EEPROM) but I think it
only has the header data for whatever reason so it always comes up in
DFU mode.

Sorry for wasting your time :(

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: Re-enumerating a device

2009-12-15 Thread Daniel O'Connor
On Tue, 15 Dec 2009, Hans Petter Selasky wrote:
  From dmesg..
  ugen0.2: Unknown at usbus0
  # Run dfu-util
  ugen0.2: Unknown at usbus0 (disconnected)
  # Cause re-enumeratae
  ugen0.2: M Audio at usbus0
  uaudio0: MobilePre on usbus0
  uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format
  uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format
  uaudio0: No midi sequencer
  pcm1: USB audio on uaudio0

 Can you show dmesg, when you do:

 usbconfig -u 0 -a 2 reset

I see nothing appear no matterwhen I run it (before or after the device 
has been programmed).

It takes about a second to run though..

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re-enumerating a device

2009-12-14 Thread Daniel O'Connor
[ Please CC me as I'm not on list ]

Hi,
I have an M-Audio MobilePre, it's a USB audio module which works with 
snd_uadio, however to get it working I need to load the firwmare (via 
DFU).

Unfortunately the only way I can get it to re-enumerate after sending 
the firmware is to unplug it enough to disconnect the data lines (but 
not power) and then reconnect.

I have tried usbconfig reset, power_off/power_on, set_config and set_alt 
but to no avail..

[inchoate 16:46] ~/projects/dfu-util-0.1.snap20090212 dfu-util -D 
~/ma004103.bin -t 256
dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY

Opening USB Device 0x:0x...
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
WARNING: Runtime device already in DFU state ?!?
Found Runtime: [0x0763:0x2804] devnum=0, cfg=0, intf=0, alt=0, name=RAM
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0100
bytes_per_hash=120
Starting download: [##] 
finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

From dmesg..
ugen0.2: Unknown at usbus0
# Run dfu-util
ugen0.2: Unknown at usbus0 (disconnected)
# Cause re-enumeratae
ugen0.2: M Audio at usbus0
uaudio0: MobilePre on usbus0
uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format
uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format
uaudio0: No midi sequencer
pcm1: USB audio on uaudio0

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2009-10-28 Thread Daniel O'Connor
On Wed, 30 Sep 2009, Daniel O'Connor wrote:
 On Mon, 28 Sep 2009, Hans Petter Selasky wrote:
  -   if (sscanf(dev, libusb:%d:%d, busnum, devnum) != 2)
  +   if ((sscanf(dev, libusb:%d:%d, busnum, devnum) != 2) 
  +   (sscanf(dev, libusb:/dev/usb:ugen%d.%d, busnum,
  devnum) != 2)) {
  DBG (DL_MAJOR_ERROR, %s: could not parse device
  string: %s\n, me, strerror(errno));
  return 0;
 
  If it works, get the patch sent to the sane developers.

 Unfortunately no (I reworked it to match the path it uses) and now it
 segfaults. I rebuilt sane with debugging (is there some way to make
 libtool not strip on install? It's so tedious manually editing
 makefiles to remove -s..) as well as libusb.

Have you had a chance to look at this? :)

Thanks.

PS I'm not subscribed to usb@ so perhaps I missed a reply.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: SANE vs USB scanner on 8.0

2009-09-30 Thread Daniel O'Connor
', bMaxPacketSize0 = 8 '\b', idVendor = 1189,
idProduct = 8288, bcdDevice = 256, iManufacturer = 1 '\001',
iProduct = 2 '\002', iSerialNumber = 0 '\0', bNumConfigurations = 1 '\001'},
  config = 0x801b23280, dev = 0x801b13d00, devnum = 0 '\0', num_children = 0 
'\0',
  children = 0x0}

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


SANE vs USB scanner on 8.0

2009-09-28 Thread Daniel O'Connor
Hi,
I'm trying to get a USB scanner to work with FreeBSD 8.0, it did work 
with 7.2 via uscanner.

It's an AcerScan 620U and I have the firmware and 
modified /usr/local/etc/sane.d/snapscan.conf.

sane-find-scanner sees it, eg
[midget 22:37] ~ sudo sane-find-scanner  -q
found USB scanner (vendor=0x04a5 [Color], product=0x2060 [ FlatbedScanner 13]) 
at libusb:/dev/usb:/dev/ugen0.5
found USB scanner (vendor=0x0403 [FTDI], product=0xee18 [MaxStream PKG-U]) at 
libusb:/dev/usb:/dev/ugen1.2

I have no idea why the FTDI serial device appears there..

However scanimage -L doesn't show the scanner..
[midget 22:40] ~ sudo env SANE_DEBUG_SNAPSCAN=255 scanimage -v -v -L
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(libusb:/dev/usb:/dev/ugen0.5)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:/dev/usb:/dev/ugen0.5)
[snapscan] snapscani_mutex_open: could not parse device string: No such file or 
directory
[snapscan] snapscani_usb_open: Can't get semaphore
[snapscan] add_usb_device: error opening device libusb:/dev/usb:/dev/ugen0.5: 
Invalid argument
[snapscan] sane_snapscan_get_devices (0x7fffe200, 0)

No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Calling sane_exit
[snapscan] sane_snapscan_exit
scanimage: finished

Anyone have any suggestions?

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


sb600/sb700 ohci experimental patch

2009-09-25 Thread Daniel O'Connor
This patch works for me, I get..

usbus0: 12Mbps Full Speed USB v1.0
(hw power) control head = 0xcfdf1c50
(hw power) control head = 0x3f7a000
usbus1: 12Mbps Full Speed USB v1.0
(hw power) control head = 0x3dd6000
(hw power) control head = 0x3dd6000
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
(hw power) control head = 0x2961000
(hw power) control head = 0x2961000
usbus4: 12Mbps Full Speed USB v1.0
(hw power) control head = 0x29a9000
(hw power) control head = 0x29a9000
usbus5: 480Mbps High Speed USB v2.0
usbus6: 12Mbps Full Speed USB v1.0
(hw power) control head = 0x41de000
(hw power) control head = 0x41de000
...
uhub2: 6 ports with 6 removable, self powered
uhub5: 6 ports with 6 removable, self powered
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000
ugen0.2: Logitech at usbus0
ums0: Logitech USB-PS/2 Optical Mouse, class 0/0, rev 2.00/27.30, addr 2 on 
usbus0
ums0: 8 buttons and [XYZ] coordinates ID=0
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000
(hw power) control head = 0x3f7a000

Thanks! :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


Re: usb/134766: Add blacklist for Cyberpower UPS to uhid

2009-05-21 Thread Daniel O'Connor
On Thu, 21 May 2009, ga...@freebsd.org wrote:
 Synopsis: Add blacklist for Cyberpower UPS to uhid

 State-Changed-From-To: open-feedback
 State-Changed-By: gavin
 State-Changed-When: Thu May 21 14:08:54 UTC 2009
 State-Changed-Why:
 To submitter: Are you sure your patch is correct?  You seem to be

Hmm, it was tested by someone and did work.

 using UQ_KBD_IGNORE rather than UQ_HID_IGNORE, which is the quirk
 used by all of the other CyberPower LCD units.  A patch for this LCD

I think UQ_HID_IGNORE is probably better.

 but using the UQ_HID_IGNORE quirk has already been committed to HEAD,
 RELENG_7 and RELENG_6 (after 7.2 was released) so it may be that we
 need to add an extra quirk to the entry that already exists.

Ahh OK, the tester only had 7.2 so I guess they didn't have the quirk..

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.


usb/134766: Add blacklist for Cyberpower UPS to uhid

2009-05-20 Thread Daniel O'Connor

Number: 134766
Category:   usb
Synopsis:   Add blacklist for Cyberpower UPS to uhid
Confidential:   no
Severity:   non-critical
Priority:   medium
Responsible:freebsd-usb
State:  open
Quarter:
Keywords:   
Date-Required:
Class:  change-request
Submitter-Id:   current-users
Arrival-Date:   Wed May 20 23:10:03 UTC 2009
Closed-Date:
Last-Modified:
Originator: Daniel O'Connor
Release:FreeBSD 7.2-RELEASE i386
Organization:
Environment:
FreeBSD substance.dyndns.org 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 
08:49:13 UTC 2009

Description:
Add blacklist quirk for uhid for a Cyberpower UPS.

How-To-Repeat:
Fix:
Index: sys/dev/usb/usb_quirks.c
===
--- sys/dev/usb/usb_quirks.c(revision 192375)
+++ sys/dev/usb/usb_quirks.c(working copy)
@@ -120,6 +120,8 @@
ANY, { UQ_KBD_IGNORE }},
  { USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24X,
ANY, { UQ_KBD_IGNORE }},
+ { USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_1500CAVRLCD,
+   ANY, { UQ_KBD_IGNORE }},
  { 0, 0, 0, { 0 } }
 };
  

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 freebsd-usb-unsubscr...@freebsd.org


USB2 enclosure doesn't work

2007-11-25 Thread Daniel O'Connor
I recently bought a Laser brand 2.5 drive enclosure and put an 80GB
WD disk in it and I can't get it working with FreeBSD (I tried 6.2 and 8.0).
It does work fine with Windows XP though.

I have another USB2 adapter (has 3.5 PATA, SATA and 2.5 PATA
connectors) and that works fine with FreeBSD.

The really weird thing is that I could fdisk even though fdisk
complained it could not write to it. I then read back the MBR and it was
changed. Just in case caching was involved I unplugged and replugged the
drive and the modified MBR was still there...

When I try to read or write to the disk dd just exits straight away with
no error (ie it got EOF on the first read/write).

Nothing unusual shows up in dmesg (eg no errors).

Here is what I see..
umass1: Super Top USB 2.0  IDE DEVICE, rev 2.00/2.01, addr 3
da4 at umass-sim1 bus 1 target 0 lun 0
da4: WDC WD80 0BEVE-00UYT0 \\\\ Fixed Direct Access SCSI-0 device
da4: 40.000MB/s transfers
da4: 76319MB (156301488 512 byte sectors: 255H 63S/T 9729C)
umass1: at uhub4 port 8 (addr 3) disconnected
(da4:umass-sim1:1:0:0): lost device
(da4:umass-sim1:1:0:0): removing device entry
umass1: detached

I plan on giving it to my mother in law for christmas (she uses Windows..)
so I can test with it for a little while yet :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc
Description: This is a digitally signed message part.