Re: Problem with USB driver using two devices

From: Greg KH
Date: Wed Nov 23 2016 - 09:57:42 EST


On Wed, Nov 23, 2016 at 02:14:23PM +0100, Wolfgang Wilhelm wrote:
> Dear Sir,

Hi!

<adding the linux-usb@xxxxxxxxxxxxxxx mailing list, as that is the
proper place for Linux USB things to be discussed> and putting stable@
in bcc: as this has nothing to do with stable kernel releases.>

>
> we are a small company FAST ComTec GmbH
> (www.fastcomtec.com) and produce multichannel analyzers
> with Windows software. I am the software developer and
> would like to get our software working also under Linux
> with the help of WINE.
>
> I was already successfull with our USB devices and most
> of our PCI cards, but now we have found that our USB
> driver does not work with the second device if more than
> one USB device is connected. The "read" function does
> not work with the second device, all other functions work.
> (tested with Debian v 8, kernel 3.16.0)
>
> The driver is based on a skeleton source provided by you.
> The driver source can be downloaded here:
>
> https://www.fastcomtec.com/ftp/usb1mcs6.zip
>
> Please could you have a look on it if you can see an error?
> Or do you think it could be an error in the Linux kernel?

This isn't a limitation in the kernel at all, something must be odd with
the driver. We can review it a bit better if you want us to.

At first glance, the driver looks fine, I don't see anything obvious
that is making it only work for one device and not others.

But, it's a bit hard to tell, what type of error messages do you get
when you plug two devices in? What is your userspace program expecting
to have happen that is not working properly here?

But, let's step back a bit, why do you need a kernel driver at all for
this device? Can you just use libusb and a userspace program to control
your device instead? That would get you a solution that worked on all
operating systems, without a need for a kernel driver for any of them.

If you really do want this to be a kernel driver, we will be glad to
review it in further detail if you wish for us to merge it into the main
kernel source tree, so that users don't have to download anything, and
then your device would "just work" with all future Linux kernel
releases.

Also note, I do see some security problems with your driver code, but
they aren't things that would cause multiple devices to not work, but
could cause problems for users with this driver loaded as you could tie
up resources in bad ways, or potentially crash the kernel easily.

thanks,

greg k-h