Where to find the information how to write a state of the art USB driver?

Greg KH greg at kroah.com
Thu Jan 13 10:33:50 EST 2022


On Thu, Jan 13, 2022 at 07:39:38AM +0100, Philipp Hortmann wrote:
> On 1/12/22 10:54 AM, Greg KH wrote:
> > That driver tried to be an example for an unknown device, doing multiple
> > different things that no single driver/device would probably ever need.
> > Also it can almost always just be replaced with a simple userspace
> > program using libusb, as I bet your driver could be replaced with as
> > well, right?
> Yes it can be replaced by a userspace program but even this is not required.

It is an issue if you are trying to write a new driver.  We do not take
new drivers into the kernel tree if they can be in the kernel instead.

> For the USB LCD a userspace program is available from vendor.

Great!

> For the USB to serial Adapter the driver exists in the kernel ch341.c.
> It appears as a ttyUSB0 device.

For devices that need to show up to userspace as a common device type
(like a serial port), we need to have a kernel driver, so this is to be
expected.

> I think what happens to very custom drivers that could be userspace programs
> can be seen in the file /drivers/usb/misc/usblcd.c
> - It is written in 2005 and is only supporting one device from one vendor.
> - I cannot find/buy a suitable device.
> - I have tried two times to contact the author of the driver but:
> The response from the remote server was:
> 550 5.1.1 <g.toth at e-biz.lu>: Recipient address rejected: User unknown
> - The idVendor = 0x10D2 does also not help because RayComposer - R. Adams
> does not response and does not seam to offer such products.

What is the problem with this driver?  If it is not hurting anyone, and
still builds, it's not causing any problems.

> To me it is unused code but how to verify? When it is unused what does the
> kernel do with it? Putting it to the staging area?

Why do you want to delete it?

We can remove old drivers that no one uses, we do that all the time.
But usually that is because the maintance burden on them get too high
and we determine that no one actually uses the thing.  This driver
doesn't seem to be causing any problems that I can see, so why delete
it?

That being said, if you do think it should be removed, great, let's do
so and if someone later shows up that uses it, we can trivially add it
back.  Just submit a patch to do so.

But this doesn't have much to do with your original question, so I'm
confused as to what usblcd.c has to do with writing a new USB driver?

thanks,

greg k-h



More information about the Kernelnewbies mailing list