Age | Commit message (Collapse) | Author |
|
(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.
|
|
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
|
|
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.
|
|
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 :)
|
|
For the port control, it can be usefull to refer to a
hub by its stable hash name.
|
|
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.
|
|
|
|
|
|
|
|
bandwidth), skip those altogether
|
|
bandwidth
This fixed frames (usually) filled with green color because
of the wrong alt settings used before.
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
repeat/delay; fix a race condition
|
|
libdisk openscsi expects that the ctl file, starts with "inquiry".
All other sd drivers do this, so nusb/disk should too.
|
|
|
|
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.
|
|
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
|
|
Since e0087b2a, usbcmd with Rh2d returns the size of the data stage
(excluding the setup packet), so adjust the expected return values
accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
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).
|
|
|
|
|
|
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").
|
|
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").
|
|
|
|
(thanks umbraticus)
|
|
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.
|
|
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.
|
|
|
|
|
|
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.
|
|
error handling in portreset() was wrong. we called closedev()
on the device without changing the reference.
just call portdetach() when the reset fails.
|
|
before setting the sampling rate, check bit D0
"Sampling Frequency" in the audio class specific
endpoint descriptor.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|