Re: USB generic driver problems

2004-05-19 Thread Chris

On Wed, 19 May 2004, Trevor Blackwell wrote:


 I'm also trying to make the Labjack work on FreeBSD 4.9. I haven't
 solved the problem, but I at least know why you're getting a device not
 configured error when writing to the USB endpoint. The ugen driver
 finds that:

   (sce-edesc-bmAttributes  UE_XFERTYPE) == UE_INTERRUPT

 but only allows a generic write for devices with XFERTYPE of UE_BULK. So
 it gives a ENXIO (device not configured) when you call write.

Makes since. So what if we override that code? ;-) I haven't looked at
this for a month or so, but I started writing my own device driver using
the existing ones as a template. I suceeded in detecting the device but
crashed the system with a type 12 when trying to connect. I'm just not
that experienced with C programming, but what better project to get a
crash course in C?

 I've also fooled around with using the uhid driver, but I haven't been
 able to complete a write with it either. If you figure it out, drop me a
 note!

I'll followup with you privately and we can post a summary to the list
when we figure it out.

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


Re: USB generic driver problems

2004-05-19 Thread Trevor Blackwell

I'm also trying to make the Labjack work on FreeBSD 4.9. I haven't
solved the problem, but I at least know why you're getting a device not
configured error when writing to the USB endpoint. The ugen driver
finds that:

  (sce-edesc-bmAttributes  UE_XFERTYPE) == UE_INTERRUPT

but only allows a generic write for devices with XFERTYPE of UE_BULK. So
it gives a ENXIO (device not configured) when you call write.

I've also fooled around with using the uhid driver, but I haven't been
able to complete a write with it either. If you figure it out, drop me a
note!

-- 
Trevor Blackwell  [EMAIL PROTECTED]   (650) 210-9272


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


USB generic driver problems

2004-03-16 Thread admin2

Repost...

As a followup, I modified the /usr/src/sys/dev/usb/ugen.c source to
provide some additional debugging output in the ugen_set_config() function
(relevant code at bottom). This is the code responsible for creating the
device structure for the USB device endpoints after retrieving the
endpoint addresses from the USB device (i.e. /dev/ugen0.EE). The
make_dev(9) call fails (see log entries below) with a non zero status.
Given the endpoints returned by the device were valid, I'm at a loss as to
why. The device works correctly under Windows 2000 (fyi). Is this a
problem with the my device, a bug, or ???

Chris

Mar 12 14:09:46 cosmo /kernel: usbd_reset_port: port 2 reset done, 
error=NORMAL_COMPLETION
Mar 12 14:09:46 cosmo /kernel: usbd_new_device bus=0xc0d2e800 port=2 depth=1 
lowspeed=512
Mar 12 14:09:46 cosmo /kernel: usbd_setup_pipe: dev=0xc0ec3f80 iface=0 ep=0xc0ec3f9c 
pipe=0xc0ec3f84
Mar 12 14:09:46 cosmo /kernel: usbd_new_device: adding unit addr=2, rev=110, class=0, 
subclass=0, protocol=0, maxpacket=8, len=18, ls=1
Mar 12 14:09:46 cosmo /kernel: usbd_new_device: new dev (addr 2), dev=0xc0ec3f80, 
parent=0xc0d30c80
Mar 12 14:09:46 cosmo /kernel: usbd_probe_and_attach: trying device specific drivers
Mar 12 14:09:46 cosmo /kernel: usbd_probe_and_attach: no device specific driver found
Mar 12 14:09:46 cosmo /kernel: usbd_probe_and_attach: looping over 1 configurations
Mar 12 14:09:46 cosmo /kernel: usbd_probe_and_attach: trying config idx=0
Mar 12 14:09:46 cosmo /kernel: usbd_set_config_index: (addr 2) attr=0x80, 
selfpowered=0, power=100
Mar 12 14:09:46 cosmo /kernel: usbd_set_config_index: set config 1
Mar 12 14:09:46 cosmo /kernel: usbd_probe_and_attach: no interface drivers found
Mar 12 14:09:46 cosmo /kernel: ugen0: LabJack Labjack U12, rev 1.10/5.f6, addr 2
Mar 12 14:09:46 cosmo /kernel: usbd_set_config_index: free old config
Mar 12 14:09:46 cosmo /kernel: usbd_set_config_index: (addr 2) attr=0x80, 
selfpowered=0, power=100
Mar 12 14:09:46 cosmo /kernel: usbd_set_config_index: set config 1
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: ugen0 to configno 1, sc=0xc0ebf000
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: ifaceno 0
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: endptno 0, endpt=0x01(1,1), 
sce=0xc0ebf264
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: endptno 1, endpt=0x02(2,0), 
sce=0xc0ebf328
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: Configuring Additional Endpoints
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: Calling make_dev for ugen0.1
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: make_dev returned -1058926464
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: Calling make_dev for ugen0.2
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: make_dev returned -1058926592
Mar 12 14:09:46 cosmo /kernel: ugen_set_config: Endpoint -1058796112 is null, can't 
call make_dev

#if defined(__FreeBSD__)
/* the main device, ctrl endpoint */
make_dev(ugen_cdevsw, UGENMINOR(USBDEVUNIT(sc-sc_dev), 0),
UID_ROOT, GID_OPERATOR, 0644, %s, USBDEVNAME(sc-sc_dev));

DPRINTFN(1,(ugen_set_config: Configuring Additional Endpoints\n));

for (endptno = 1; endptno  USB_MAX_ENDPOINTS; endptno++) {
if (sc-sc_endpoints[endptno][IN].sc != NULL ||
sc-sc_endpoints[endptno][OUT].sc != NULL ) {
/* endpt can be 0x81 and 0x01, representing
 * endpoint address 0x01 and IN/OUT directions.
 * We map both endpts to the same device,
 * IN is reading from it, OUT is writing to it.
 *
 * In the if clause above we check whether one
 * of the structs is populated.
 */
DPRINTFN(1,(ugen_set_config: Calling make_dev for 
%s.%d\n,USBDEVNAME(sc-sc_dev), endptno));
myerr = make_dev(ugen_cdevsw,
UGENMINOR(USBDEVUNIT(sc-sc_dev), endptno),
UID_ROOT, GID_OPERATOR, 0644,
%s.%d,
USBDEVNAME(sc-sc_dev), endptno);
DPRINTFN(1,(ugen_set_config: make_dev returned %d\n, myerr) 
);
} else {
DPRINTFN(1,(ugen_set_config: Endpoint %d is null, can't call 
make_dev\n, USBDEVNAME(sc-sc_dev), endptno))
;
}
}
#endif

On Thu, 11 Mar 2004 [EMAIL PROTECTED] wrote:


 I'm attempting to interface with a usb based data acquisition device
 called a Labjack (http://labjack.com) under FreeBSD 4.9. The Labjack is a
 USB1.1 compliant HID device with a single configuration and two
 interrupt endpoints (in/out) not including the control endpoint.

 Initially I tried to use the uhid driver, but due to lack of functionality
 needed in this case I removed the uhid driver from the kernel in favor of
 the ugen driver. The ugen driver