summaryrefslogtreecommitdiff
path: root/sys/src/cmd/nusb/lib
AgeCommit message (Collapse)Author
2022-12-23usbd: use dprint() report to standard-error instad of standard-outcinap_lenrek
2022-02-23nusb/lib: provide a setalt() function to set the interface to its altsettingcinap_lenrek
2022-02-21nusb: Fix handling of interface altsetting.cinap_lenrek
The altsetting was handled only for a single endpoint (per interface number), but has to be handled for each endpoint (per interface *AND* altsetting number). A multi function device (like a disk) can have multiple interfaces, all with the same interface number but varying altsetting numbers and each of these interfaces would list distict endpoint configurations. Multiple interfaces can even share some endpoints (they use the same endpoint addresses), but we still have to duplicate them for each interface+altsetting number (as they'r part of actually distict interfaces with distict endpoint configurations). It is also important to *NOT* make endpoints bi-directional (dir == Eboth) when only one direction is used in a interface/altsetting and the other direction in another. This was the case for nusb/disk with some seagate drive where endpoints where shared between the UAS and usb storage class interface (but with distict altsettings). The duplicate endpoints (as in using the same endpoint address) are chained together by a next pointer and the head is stored in Usbdev.ep[addr], where addr is the endpoint address. These Ep structures will have distinct endpoint numbers Ep.id (when they have conflicting types), but all will share the endpoint address (lower 4 bits of the endpoint number). The consequence is that all of the endpoints configuration (attributes, interval) is now stored in the Ep struct and no more Altc struct is present. A pointer to the Ep struct has to be passed to openep() for it to configure the endpoint. For the Iface struct, we will now create multiple of them: one for each interface *AND* altsetting nunber, chained together on a next pointer and the head being stored in conf->iface[ifaceid]. -- cinap
2021-02-10nusb: don't create rw iso endpoints (by Michael Forney)cinap_lenrek
There may be two iso endpoints with the same ID if it is asynchronous or adaptive (one for data, one for feedback), and rw iso endpoints are unusable (error out with "iso i/o is half-duplex").
2021-02-10nusb: don't create rw iso endpoints (by Michael Forney)cinap_lenrek
There may be two iso endpoints with the same ID if it is asynchronous or adaptive (one for data, one for feedback), and rw iso endpoints are unusable (error out with "iso i/o is half-duplex").
2020-08-23nusb/lib: use fmtprint for the entire dump to be printed outSigrid
2019-05-07nusb/usbd: work around devices that ignore the high byte of wLength in ↵cinap_lenrek
control transfer reads there appear to be devices out there such as Realtek RTL2838UHIDIR SDR that do not process control transfers correctly, ignoring the high byte of the wLength field. to work around this, we specify an odd number of bytes for read sizes >= 256 which keeps the low byte 0xFF.
2018-03-07usb lib: add maxpkt and ntds to Altc structaiju
2017-07-31nusb/*: cleanupcinap_lenrek
2017-07-31nusb/usbd: create endpoint files for conf #1, usb3 preparationcinap_lenrek
2017-07-24usb: fix wrong pollival calculation in setmaxpkt()cinap_lenrek
2017-04-01nusb/lib: make usbcmd() return value symmetic; returning size of data phase ↵cinap_lenrek
(if any) (thanks aiju) usbcmd() with Rh2d used to return the command size (8+ndata) wile returning only ndata for Rd2h. this changes it to always return ndata for Rh2d. it mostly doesnt matter as Rh2d callers only check r < 0 for error, but this makes the interface symmetic.
2016-09-28nusb/lib: fix wrong endpoint id when openep() finds already existing ↵cinap_lenrek
endpoint file
2014-06-28nusb: fix spelling, sorrycinap_lenrek
2014-06-28nusb: implement aijus stable uniqueue device namescinap_lenrek
instead of naming devices by ther dynamically assigned device address, we hash device uniqueue fields from the device descriptor and produce a 5 digit hex string that will identify the device across machines. when there is a collision (less than 1% chance with 100 devices), usbd will append the device address to the name to make it uniqueue for this machine. the hname is passed to drivers in the devid argument, which now has the form addr:hname, where the colon and hname can be omited (for backwards compatibility). when the new behaviour isnt desired, nousbhname= environment variable can be defined giving the old behaviour.
2014-04-24revert previous change, i was confused.cinap_lenrek
2014-04-24nusb: use ep->addr instead of ep->id in unstall() library functioncinap_lenrek
this is not a bug, but using ep->addr makes the intend more clear.
2014-04-23nusb: resolve endpoint id conflict with different input and output typescinap_lenrek
ftrvxmtrx repots devices that use the endpoint number for input and output of different types like: nusb/ether: parsedesc endpoint 5[7] 07 05 81 03 08 00 09 # ep1 in intr nusb/ether: parsedesc endpoint 5[7] 07 05 82 02 00 02 00 nusb/ether: parsedesc endpoint 5[7] 07 05 01 02 00 02 00 # ep1 out bulk the previous change tried to work arround this but had the concequence that only the lastly defined endpoint was usable. this change addresses the issue by allowing up to 32 endpoints per device (16 output + 16 input endpoints) in devusb. the hci driver will ignore the 4th bit and will only use the lower 4 bits as endpoint address when talking to the usb device. when we encounter a conflict, we map the input endpoint to the upper id range 16..31 and the output endpoint to id 0..15 so two distinct endpoints are created.
2014-04-23nusb: workaround for endpoints with same index but different typesftrvxmtrx
nusb code assumes endpoint numbers are unique. It's true in general case, but it becomes false once the direction bit is ignored. The commit adds a check so that two endpoints of different types are not merged into one with Eboth direction. It does overwrite endpoint though, so it shouldn't be considered as a full fix.
2014-04-19nusb: dont include <bio.h>, we'r not using it (thanks erik)cinap_lenrek
2014-03-06nusb: fix loaddevstr() (thanks erik quanstro and richard miller)cinap_lenrek
loaddevstr() should request 256 bytes, as per standard and respect the length embedded in the string.
2013-07-05nusb: only read 18 bytes for device descriptorppatience0
2012-12-10nusb: provide language id when reading string descriptors (thanks ftrvxmtrx)cinap_lenrek
there are devices which do not return a string if used with invalid language id, so at least try to use the first one and choose english if failed. this fixes CDC ethernet for N900
2012-09-06nusb: handle 0 csp value on iface, remove unneeded configdev() calls after ↵cinap_lenrek
getdev()
2011-08-26nusb: fix documentation, cleanup, remove /sys/src/cmd/usbcinap_lenrek
2011-07-27nusb: improvedaiju