Re: [PATCH 1/2] rust: usb: add basic USB abstractions
From: Greg Kroah-Hartman
Date: Tue Sep 23 2025 - 10:37:59 EST
On Tue, Sep 23, 2025 at 04:25:46PM +0200, Danilo Krummrich wrote:
> On 9/23/25 4:22 PM, Greg Kroah-Hartman wrote:
> > On Tue, Sep 23, 2025 at 04:16:36PM +0200, Oliver Neukum wrote:
> >> On 23.09.25 16:13, Greg Kroah-Hartman wrote:
> >>
> >>> Functions like usb_fill_bulk_urb() takes a pointer to a usb_device, not
> >>> an interface. Yes, we should fix that, but that "mistake" dates way way
> >>> way back to the original USB api decades ago. So much so that I didn't
> >>> even remember that we used that pointer there :)
> >>
> >> How would we do that? We need to be able to send at least control
> >> request to devices before we have established which configurations
> >> or interfaces the device has.
> >
> > Oops, I thought that usb_dev in struct usb_interface was a pointer to
> > struct usb_device, but no, it's something else... So no, we need to
> > keep that as-is for now.
>
> You can still get it via interface_to_usbdev(), no?
Sigh, this is what I get for writing emails while sitting in a
conference...
Yes, you are right, it can be gotten that way. But I can't wait to see
how you wrap that C macro in rust :)
thanks,
greg k-h