tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: USB LKM driver question (pwc port) said:
> However, I am unsure as to what I shall put in the MOD_DRV declaration
>  that follows USB_DECLARE_DRIVER. I found no help looking around in
> the  examples, since no LKM handles USB. 

I'm currently working on some changes to improve loadable
driver support for USB. As things look now, you might be able
to get an LKM working with the existing framework, if you
load the LKM before plugging in the device.

I'd suggest using eg sys/lkm/dev/pci/dummy_pci as a starting
point. You need to adapt the attachment information to the
USB "usbifif" interface, see dev/usb/files.usb.
("usbifif" means "interface interface", it should be used
because the video stuff takes only one interface out of three,
and leaves the other two to audio which is hopefully handled
by the standard uaudio driver.)
So the locator array ("pciloc" in the template) would
be "{-1,-1,-1,-1,-1,-1}, corresponding to the default
locators in the "usbifif" definition.
The "pciparent" would turn into "{"usbifif", "uhub", DVUNIT_ANY}".
The rest should be like in the pci example.
Your match/attach functions get the per-interface structures
passed in the "aux" argument, so the "USB_IFMATCH_START"
and "USB_IFATTACH_START" macros are the correct ones.
(I'd open-code that stuff, the macros pretend some source
compatibility to FreeBSD which isn't there anymore.)

I can't guarantee that this really works, but it is worth a try.

best regards

Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt

Home | Main Index | Thread Index | Old Index