Linux Driver Porting Advice

Alexander Boettcher alexander.boettcher at genode-labs.com
Thu Apr 8 14:15:30 CEST 2021


Hello,

On 08.04.21 05:59, John J. Karcher wrote:
> Hello Everyone,
> 
> I have been (very slowly) trying my hand at adding the missing Wacom touchscreen functionality to the "usb_hid" driver, and I am encountering some of the friction Stefan describes in his recent Genodians article on porting Linux drivers.  (I have the additional handicap of not knowing what I'm doing, but that just makes it a learning experience. ;^) )
> 
> In that context, I'd like to ask for a little advice.
> 
> Since the "usb_hid" driver is generally working, the main problem is implementing missing functions.  After some fumbling, I have settled on commenting out sections of "dummies.c" and pulling more files in from the Linux source (rather than copying massive chunks into local files).  To do this, I am adding files to "usb_hid.list", then doing "prepare_port dde_linux" and "make drivers/usb_hid".
> 
> First question: Is this the right basic idea?

Yes.

> 
> Using this approach, I have been able to reduce the number of build errors.  It looks like there are only a few left (although this could easily be a mirage).  But I'm stumbling on conflicting headers, which has led me to an interesting discovery - the "build/x86_64/var/libcache/usb_hid_include/include/include/include/linux/" directory, which is filled with symlinks to "repos/dde_linux/src/drivers/usb_hid/lx_emul.h".
> 
> Second question: Where is this controlled?  I assume that if I pull in the real "device.h", for example, I should be able to remove "device.h" from a list somewhere that generates these symlinks.  Is that correct?

The symbolic links are generated by the mk file of the ported driver, e.g. read https://genode.org/documentation/developer-resources/porting_device_drivers#Further_preparations for the basic idea.
In your case, it is done in repos/dde_linux/lib/mk/usb_hid_include.mk.

Cheers,

-- 
Alexander Boettcher
Genode Labs

https://www.genode-labs.com - https://www.genode.org

Genode Labs GmbH - Amtsgericht Dresden - HRB 28424 - Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



More information about the users mailing list