summaryrefslogtreecommitdiff
path: root/sys/src/cmd/nusb
AgeCommit message (Collapse)Author
2023-04-12nusb/usbd: only fetch first 8 bytes of device descriptor for getmaxpkt() ↵cinap_lenrek
(thanks k0ga) The first usb transaction we run on a device is reading the device descriptor, but todo this we need to know the maximum packet size on the control endpoint. But the packet size itself is stored in the device descriptor which needs to be read over the control endpoint. We used to fetch up to 64 bytes of device descriptor, and if that fails assume some default values. But this seems to cause errors down the line for some devices like k0gas usb keyboard. The new way is to read *ONLY* the first 8 bytes (that contain the bMaxPktSize0 field) and fetch the full device descriptor later once we have set the correct packet size.
2023-02-19mkfiles: add 'mk test' supportOri Bernstein
9front has several tests scattered throughout the source, as well as more tests in an external 'regress' repository. Many of these tests are broken, because there is no easy way to build and track all of them. This pulls in several tests from different sources, deletes the broken tests, tests with missing data, and adds a single command that can be run from the root of the src directory to test our system. The hope is that as we develop new code, we add more tests, and eventually start running the tests on every commit. Please enter the commit message for your changes. Lines starting
2023-01-29nusb/ether: support for asix ax88179 (thanks Aidan K. Wiggins)cinap_lenrek
Tested with tp-link UE305, works well. From all other sources it seems this should also work for the 88178a, but I didn't have one on hand.
2023-01-29nusb/kb: GAOMON S620 tablet supportcinap_lenrek
The GAOMON S620 tablet is recognized as a HID device, but is restricted in the X-axis to the width of a mobile phone. I sniffed usb traffic for generic windows 10 hid driver and there didnt seem anything out of the ordinary. It turns out that this is some kind of phone feature and i suspect they have some heuristic for how windows reads the device and config descriptors to decide if this is windows or android. Checking the DIGImend project git repository, they suggest this is some kind of UCLOGIC compatible tablet, which once a series of string properties have been read will switch itself to some different mode. The report descriptor is supposed to be generated from the string properties, but the report format didnt really match theirs. So i ignore the string properties and just looked at the report data. The format after reading the magic string properties seems to be: 08 - report id bb - buttons: 0x80 = inrange, 0x04 = eraser, 0x02, barrel, 0x01 = touch xx xx - x-axis: [0x0000-0x80000) yy yy - y-axis: [0x0000-0x50000) pp pp - pressure: [0x0000-0xffff] ?? ?? - unknown So i hand rolled a hid report descriptor for this and call it a day :)
2023-01-05nusb/usbd: assign hname to hubscinap_lenrek
For the port control, it can be usefull to refer to a hub by its stable hash name.
2023-01-05nusb/usbd: add /dev/usbhubctl file to control port power and led indicatorscinap_lenrek
Experimental feature: echo portpower <hub> <port> on/off > /dev/usbhubctl echo portindicator <hub> <port> on/off > /dev/usbhubctl Where <hub> is the device number of the hub (as in /dev/usb/epX) and <port> is the port index (1..n). Hub and port numbers can be found by reading /dev/usb/ctl.
2023-01-05nusb/usbd: provide vid and did in device info string for hubscinap_lenrek
2022-12-23usbd: use dprint() report to standard-error instad of standard-outcinap_lenrek
2022-11-14nusb/cam: interrupt reader proc on close to unstuck itSigrid Solveig Haflínudóttir
2022-11-14nusb/cam: rather than showing partially green frames (when not enough ↵Sigrid Solveig Haflínudóttir
bandwidth), skip those altogether
2022-11-13nusb/cam: take max payload transfer size into account when selecting for ↵Sigrid Solveig Haflínudóttir
bandwidth This fixed frames (usually) filled with green color because of the wrong alt settings used before.
2022-11-13nusb/cam: remove wrong func prototypes, print probe controlSigrid Solveig Haflínudóttir
2022-11-13nusb/cam: rewrite yuy2convert with integer arithmeticSigrid Solveig Haflínudóttir
2022-10-08nusb/disk: always allow raw scsi request (even without media present)cinap_lenrek
2022-10-07nusb/kb: support 無変換, 変換, and 'ひらがな / カタカナ' keysJacob Moody
These usb codes are defined for Japanese OADG 109(A) layouts. The scancodes are already defined in /sys/lib/kbmap/jp, they map to ^l, ^\, and ^n (^v with shift). These perform actions true to form in ktrans already: clearing the line buffer, completing to kanji, and switching between hiragana and katakana. http://hp.vector.co.jp/authors/VA003720/lpproj/others/kbdjpn.htm tested with 109A layout tex shinobi
2022-10-06nusb/kb: add "rawon"/"rawoff" to switch ctl fid into raw report output modeSigrid Solveig Haflínudóttir
2022-10-06nusb/kb, aux/kbdfs: add brightness down/up media keysSigrid Solveig Haflínudóttir
2022-10-04aux/kbdfs, nusb/kb: add basic media keys support; add /dev/hidNctl to change ↵Sigrid Solveig Haflínudóttir
repeat/delay; fix a race condition
2022-10-01nusb/disk: fix interactions with libdiskArne Meyer
libdisk openscsi expects that the ctl file, starts with "inquiry". All other sd drivers do this, so nusb/disk should too.
2022-09-28nusb/kb: fix scancode for right ctlSigrid Solveig Haflínudóttir
2022-06-30nusb/ptp: increase payloadakw@oneirism.org
A silly little patch, but some ptp devices (like the camera I own) use USB3 endpoints and subsequently require the data size of the payload to be 1024(-12 for metadata). This is reflected in libgphoto2's current ptp driver.
2022-06-18nusb/usbd: retry opendevtata() a few times on attach (work around mnt-reform ↵cinap_lenrek
trackball) this is a known and already fixed issue with version the following version of the mnt-reform trackball firmware: https://source.mnt.re/reform/reform/-/commit/55ca5bf848b57cdf6e7243fc1018411f6c8ab9b5
2022-01-01nusb/serial: fix pl2303 usbcmd error checksMichael Forney
Since e0087b2a, usbcmd with Rh2d returns the size of the data stage (excluding the setup packet), so adjust the expected return values accordingly.
2022-02-23nusb/disk: use setalt(), print argv0 in prints instead of "disk:"cinap_lenrek
2022-02-23nusb/cam: fix mistake (nil vs -1)cinap_lenrek
2022-02-23nusb/audio: use setalt(), make sure endpoint has right direction.cinap_lenrek
2022-02-23nusb/cam: use setalt()cinap_lenrek
2022-02-23nusb/ether: use setalt()cinap_lenrek
2022-02-23nusb/lib: provide a setalt() function to set the interface to its altsettingcinap_lenrek
2022-02-23nusb/ether: remove csp check for rndis, already done in nusbrccinap_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
2022-02-06nusb/usbd: use per hname collision counter instead of device address to ↵cinap_lenrek
resolve collisions The device address is highly variable and depends on all prior enumerated devices. This can happen with some devices that do not have a serial number and all devices of the same type having the same hname. Using a counter of collisions per hname makes more sense and is more stable (given that the order devices are enumerated is deterministic).
2021-04-20nusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8)Sigrid
2021-04-01[9front] [patch] nusb/ether -t rndisRomano
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").
2021-01-22nusb/kb: correct Mod4 scancode (125 → 91, to match what kbdfs has)Sigrid
2020-12-08nusb/kb: update button state if event was actually received, fix typos ↵Sigrid
(thanks umbraticus)
2020-11-21nusb/kb, nusb/joy: dont try to set protocol on nonboot devicesmischief
the hid 1.11 specification says that for hid devices which arent in the boot subclass (subclass 1), it is only optional to support the set protocol command. for my devices, trying to set protocol results in a stall error and unusable devices. fixes my Tex Shinobi keyboard and Playstation 4 controller.
2020-11-16nusb/cam: don't videoclose() when open failedcinap_lenrek
The fsdestroyfid() is called regardless if the open succeeded or failed. This causes erroneous videoclose() when opening the frame or video file while the camera is active.
2020-10-17nusb/serial: add ids for FT230X (thanks mischief)Ori Bernstein
2020-08-23nusb/lib: use fmtprint for the entire dump to be printed outSigrid
2020-05-08nusb/kb: add quirks for Elecom HUGE trackballkvik
As said in the code comment: Elecom trackball report descriptor lies by omission, failing to mention all its buttons. We patch the descriptor with a correct count which lets us parse full reports. Tested with: Elecom HUGE (M-HT1DRBK, M-HT1URBK) The descriptor fixup is adapted from Linux kernel: drivers/hid/hid-elecom.c in which a more detailed account of why and how this works may be found. A followup change to nusb/kb will be needed to expose these additional events for potential remapping.
2020-04-05nusb/usbd: fix portreset error handlingcinap_lenrek
error handling in portreset() was wrong. we called closedev() on the device without changing the reference. just call portdetach() when the reset fails.
2020-04-05nusb/audio: set frequency only when supportedcinap_lenrek
before setting the sampling rate, check bit D0 "Sampling Frequency" in the audio class specific endpoint descriptor.
2020-03-08nusb/usbd: cleanup processes on unmountcinap_lenrek
this makes sure that when postsharesrv() fails (for example because the shr file already exists), the worker process gets killed and all file descriptors to devusb get closed.
2020-03-07nusb/usbd: fix /env/usbbusy bugcinap_lenrek
run the usb hub poll "work()" proc in the same filedescriptor group as the fileserver by forking the process in Srv.start callback. this also prevents the usbbusy filedescriptor from being kept open by the fileserver process.
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.
2019-04-18nusb/usbd: stop sending port enable commandsmischief
from what i can tell, sending port enable is a spec violation. this fixes a hang during hub enumeration in the ASMedia xhci controller when i plug in my IBM UltraNav SK-8845. also, send unsuspend when port is suspended instead of enable. from the USB 2 specification: 11.24.2.7.1.2 PORT_ENABLE ... This bit may be set only as a result of a SetPortFeature(PORT_ENABLE). ... The hub response to a SetPortFeature(PORT_ENABLE) request is not specified.
2019-04-13nusb/usbd: fix dump %U formattermischief