On 10.04.23 21:37, Alan Stern wrote: Hi,
To make this checking as simple as possible, we now add a couple of utility routines to the USB core. usb_check_bulk_endpoints() and usb_check_int_endpoints() take an interface pointer together with a list of endpoint addresses (numbers and directions). They check that the interface's current alternate setting includes endpoints with those addresses and that each of these endpoints has the right type: bulk or interrupt, respectively. Although we already have usb_find_common_endpoints() and related routines meant for a similar purpose, they are not well suited for this kind of checking. Those routines find endpoints of various kinds, but only one (either the first or the last) of each kind, and they don't verify that the endpoints' addresses agree with what the caller expects.
these will do the job. Yet this strikes me as unelegant. That is if you define a data structure to match against, why not add a pointer to it to struct usb_device_id and use that? Basically the table of endpoints you are creating is a description of a device. Why add code for checking it to each probe() method that needs it? Regards Oliver