atom feed19 messages in org.freebsd.freebsd-hackersTricky USB device.
FromSent OnAttachments
David GilbertApr 8, 2005 9:40 am 
Maksim YevmenkinApr 8, 2005 9:48 am 
David GilbertApr 8, 2005 9:56 am 
Maksim YevmenkinApr 8, 2005 10:10 am 
David GilbertApr 8, 2005 10:16 am 
Bernd WalterApr 8, 2005 12:05 pm 
David GilbertApr 8, 2005 3:12 pm 
Maksim YevmenkinApr 8, 2005 3:33 pm 
Bernd WalterApr 8, 2005 4:12 pm 
Bernd WalterApr 8, 2005 4:33 pm 
Maksim YevmenkinApr 8, 2005 4:47 pm 
Bernd WalterApr 8, 2005 5:31 pm 
Julian ElischerApr 8, 2005 6:06 pm 
Bernd WalterApr 8, 2005 9:02 pm 
David GilbertApr 9, 2005 2:05 pm 
Bernd WalterApr 9, 2005 2:24 pm 
David GilbertApr 9, 2005 2:48 pm 
Bernd WalterApr 9, 2005 2:57 pm 
David GilbertApr 9, 2005 7:39 pm 
Subject:Tricky USB device.
From:Julian Elischer (jul@elischer.org)
Date:Apr 8, 2005 6:06:11 pm
List:org.freebsd.freebsd-hackers

Maksim Yevmenkin wrote:

Bernd Walter wrote:

On Fri, Apr 08, 2005 at 06:12:33PM -0400, David Gilbert wrote:

Bernd> Has this device multiple interfaces? e.g. one HID and another Bernd> as described. I often thought about getting ugen working at Bernd> interface level too.

Here's the output of udesc_dump on it. Right now, using the current version of libusb (not the version from ports), I can use usb_interrupt_write(dev, 1, "MK255", 5, 0) to send data to it --- and the data is sent --- at least lights on the USB hub flash. If I replace '1' with anything else, it doesn't accept it. However, it doesn't seem to have opened the relays.

Yes - you must use 1 - there is only one out-endpoint. 0x81 is for receiving data and endpoint 0 is the mandandory control endpoint. Interrupt Endpoints are not variable in size. Both interrupt endpoints are 8 Bytes, so you must read and write exact 8 Bytes per transfer - 5 shouldn't work for USB compliant devices.

the device may accept 5 bytes of data. if it's feeling charitable. but you probably should send teh number of bytes suggested by the endpoint descriptor. that number is at least guaranteed to work. Hang on.. I'm trying to remember if the 8 includes the header.. if so then you probably only get 5 bytes of data space.. I need to go back to my USB book.

From what I saw before, you may need to set the configuration number to 1 before it will do anything. so you may need to do a setConfiguration(1) then you should be able to read on the descriptor for endpoint 81. it should block until there is some activity to report on the switch. I'm guessing writing all 1s to endpoint 1 sets some leds or something.

hmmm... i was always confused about bMaxPacketSize. i was thinking that it limits the size of one usb transaction, and it could take several usb transactions to transfer one data packet.

for example i have a bluetooth usb dongle that has

Standard Endpoint Descriptor: bLength 7 bDescriptorType 05 bEndpointAddress 81 (in) bmAttributes 03 (Interruput) wMaxPacketSize 16 bInterval 1

and i certanly can receive data packets from this endpoint that are more (and less) then 16 bytes in size. so, i would guess (and i might be wrong) that it is ok to send/receive data packets that are not equal to bMaxPacketSize in size.

yes bMaxPacketSize is the maximum single packet that the endpoint will handle, however many such transactions can be used to make up a USB request fronm the user..