Commit graph

16 commits

Author SHA1 Message Date
akw@oneirism.org 6dbfe8c356 nusb/ptp: increase payload
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-30 01:58:01 +00:00
cinap_lenrek 065d601916 nusb: Fix handling of interface altsetting.
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-21 19:50:16 +00:00
mischief c3c7429dc2 nusb/ptp: set storage name to their human readable description string 2018-03-17 15:06:13 -07:00
cinap_lenrek a2e8246ffc nusb: add missing header dependencies to mkfiles 2018-02-18 02:06:55 +01:00
mischief 5ef9330b6f nusb/ptp: treat any assocation as a directory
previously nusb/ptp showed only 'generic folder' association type as directories, but all associations work as directories. tested with LG G5/android 7.0
2017-04-21 15:09:50 -07:00
cinap_lenrek d8d26c7001 nusb/ptp: do maxpkt reads to avoid babble error with usb 2.0 devices (thanks mischief!)
mischief got babble error with his mobile phone as we used to
read at max 64 bytes for the data response phase. his device
has 512 byte packet size.

thans to mischief for the patience.
2014-08-13 01:10:59 +02:00
cinap_lenrek 4275c49e72 nusb: implement aijus stable uniqueue device names
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-06-28 18:09:43 +02:00
cinap_lenrek ec572a53a9 ptp: fix alignment assumptions for amd64 2014-06-28 01:36:37 +02:00
cinap_lenrek b94c766fef nusb: dont include <bio.h>, we'r not using it (thanks erik) 2014-04-19 16:18:39 +02:00
cinap_lenrek a064a48e6d nusb: handle 0 csp value on iface, remove unneeded configdev() calls after getdev() 2012-09-06 05:25:23 +02:00
cinap_lenrek b298429804 ptp: fix fallback case 2011-09-03 03:26:44 +02:00
glenda e2f0077935 ptp: screw interrupts, use GetPartialObject to make rpcs shorter so it doesnt matter when we flush 2011-09-02 19:25:17 -04:00
cinap_lenrek 68576f5119 nusb/ptp: fix memory leaks, use libthread/ioprocs, cleanup 2011-08-22 03:05:01 +02:00
cinap_lenrek d25b95f4f2 nusb/ptp: implement flushing 2011-08-19 05:19:57 +02:00
cinap_lenrek 9f65da6d70 usb/ptp: ignore zero reads 2011-08-17 00:46:33 +02:00
cinap_lenrek b0f1c5ed6c usb ptp camera driver 2011-08-16 01:47:59 +02:00