Skip to contentSkip to conversation

problem with "serial" driver in kernel 3.16.0

DISCUSSION Wolfgang Wilhelm 3 participants 10 messages Sep 17, 2015 – Nov 23, 2016 1 message not in the archive Stable branch

lore
Share & tools
lore
#0 lore raw

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 with one of the PCI cards it does not work (in Debian v8, kernel 3.16.0).

Our PCI cards have a AMCC controller S5933, we use the standard AMCC vendor id 0x10e8 and device id 0x8226, device class serial. Most of our cards use two I/O port ranges and an interrupt. I have written a linux driver for these cards and could get everything working, but the interface card for our MPA-3 multiparameter system uses only
one I/O port range and an interrupt. This card is recognized by the "serial" driver in the kernel as a serial interface card and there is no way to load our own driver.

My question is, could you remove in future kernel versions the support for this card in the kernel our make it possible to blacklist it in /etc/modprobe.d/fbdev-blacklist.conf like other drivers that are not directly included in the kernel?

With best regards
Wolfgang Wilhelm
-----
Dr. Wolfgang Wilhelm, FAST ComTec GmbH Gruenwalder Weg 28a, 82041 Oberhaching, Germany Phone +49 89 665180 28, Fax +49 89 665180 40 mailto:[email protected] http://www.fastcomtec.com
Handelsregister Muenchen HRB 73004
General Manager: Dr. Wolfgang Wagner

#1 lore raw
Quoted 20 lines · Wolfgang Wilhelm

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 with one of the PCI cards it does not work (in Debian v8, kernel 3.16.0).

Our PCI cards have a AMCC controller S5933, we use the standard AMCC vendor id 0x10e8 and device id 0x8226, device class serial. Most of our cards use two I/O port ranges and an interrupt. I have written a linux driver for these cards and could get everything working, but the interface card for our MPA-3 multiparameter system uses only
one I/O port range and an interrupt. This card is recognized by the "serial" driver in the kernel as a serial interface card and there is no way to load our own driver.

Quoted 4 lines

My question is, could you remove in future kernel versions the support for this card in the kernel our make it possible to blacklist it in /etc/modprobe.d/fbdev-blacklist.conf like other drivers that are not directly included in the kernel?

We like to include all drivers in the kernel source tree, that's the only way to distribute kernel drivers. So can you just submit your driver for inclusion, that way everyone will be able to use the hardware properly. Look at the kernel file, Documentation/SubmittingDrivers and Documentation/SubmittingPatches for the process on how to do this.

If you have any specific questions about this, please let me know and I'll be glad to help you out.

thanks,

greg k-h

#2 lore raw
In reply to Wolfgang Wilhelm
Quoted 5 lines · Wolfgang Wilhelm

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.

Before I go any further, I would like to thank you for even considering this option. If there were more vendors who tried this, Linux would have much better support for quite a large number of hardware devices.

Quoted 14 lines

I was already successfull with our USB devices and most of our PCI cards, but with one of the PCI cards it does not work (in Debian v8, kernel 3.16.0).

Our PCI cards have a AMCC controller S5933, we use the standard AMCC vendor id 0x10e8 and device id 0x8226, device class serial. Most of our cards use two I/O port ranges and an interrupt. I have written a linux driver for these cards and could get everything working, but the interface card for our MPA-3 multiparameter system uses only
one I/O port range and an interrupt. This card is recognized by the "serial" driver in the kernel as a serial interface card and there is no way to load our own driver.

Quoted 4 lines

My question is, could you remove in future kernel versions the support for this card in the kernel our make it possible to blacklist it in /etc/modprobe.d/fbdev-blacklist.conf like other drivers that are not directly included in the kernel?

Removal is probably not an option (if there is a kernel driver for the chip already, there are almost certainly other drivers that use this chip). As far as blacklisting goes, that would be something to take up with the distribution you are developing for (so Debian from what you've said), although you may not get much help there either if the driver isn't open source. In general, it's better to either get your driver in the kernel at the source code level (which in turn includes help with ABI updates on the kernel side), or find some way to write it entirely in userspace (I'd suggest lucking at either the VFIO subsystem or the older userspace driver framework for this).

#3 lore raw

Thankyou very much for your quick answers. I searched now in the linux sources for the problem and I think I could find it in the file linux-source-3.16/drivers/tty/serial/8250/8250_pci.c

There is a function serial_pci_guessboard and a blacklist including the vendor- and device-ids of 3 softmodems and 2 multi-io cards. I think if the vendor id 0x10e8 (standard AMCC) and device id 0x8226 could be inserted into that blacklist I could load our driver and get the software for our MPA-3 multiparameter system working. It seems that these id's are not really used by any existing serial card, but this guessboard function anyway takes our card as a serial board.

Is this a matter of the Debian distribution or the general linux kernel?

Best regards,
Wolfgang Wilhelm

Betreff: Re: problem with "serial" driver in kernel 3.16.0
An: Wolfgang Wilhelm <[email protected]>, [email protected]
Kopie an: [email protected]
Von: Austin S Hemmelgarn <[email protected]>
Datum: Thu, 17 Sep 2015 16:03:52 -0400

Quoted 5 lines · Wolfgang Wilhelm

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.

Before I go any further, I would like to thank you for even considering
this option. If there were more vendors who tried this, Linux would have much better support for quite a large number of hardware devices.

Quoted 14 lines

I was already successfull with our USB devices and most of our PCI cards, but with one of the PCI cards it does not work (in Debian v8, kernel 3.16.0).

Our PCI cards have a AMCC controller S5933, we use the standard AMCC vendor id 0x10e8 and device id 0x8226, device class serial. Most of our cards use two I/O port ranges and an interrupt. I have written a linux driver for these cards and could get everything working, but the interface card for our MPA-3 multiparameter system uses only
one I/O port range and an interrupt. This card is recognized by the "serial" driver in the kernel as a serial interface card and there is no way to load our own driver.

Quoted 4 lines

My question is, could you remove in future kernel versions the support for this card in the kernel our make it possible to blacklist it in /etc/modprobe.d/fbdev-blacklist.conf like other drivers that are not directly included in the kernel?

Removal is probably not an option (if there is a kernel driver for the chip already, there are almost certainly other drivers that use this chip). As far as blacklisting goes, that would be something to take up with the distribution you are developing for (so Debian from what you've said), although you may not get much help there either if the driver isn't open source. In general, it's better to either get your driver in the kernel at the source code level (which in turn includes help with ABI updates on the kernel side), or find some way to write it entirely in userspace (I'd suggest lucking at either the VFIO subsystem or the older userspace driver framework for this).

#4 lore raw
Quoted 4 lines · Wolfgang Wilhelm

Thankyou very much for your quick answers. I searched now in the linux sources for the problem and I think I could find it in the file linux-source-3.16/drivers/tty/serial/8250/8250_pci.c

Quoted 8 lines

There is a function serial_pci_guessboard and a blacklist including the vendor- and device-ids of 3 softmodems and 2 multi-io cards. I think if the vendor id 0x10e8 (standard AMCC) and device id 0x8226 could be inserted into that blacklist I could load our driver and get the software for our MPA-3 multiparameter system working. It seems that these id's are not really used by any existing serial card, but this guessboard function anyway takes our card as a serial board.

Who makes this card, you? Why is the serial driver grabbing it if it is not a serial device?

Quoted 1 line

Is this a matter of the Debian distribution or the general linux kernel?

The kernel is responsible for this, but I would like to see your driver before marking this device as blacklisted. Do you have a pointer to the source for it anywhere?

thanks,

greg k-h

#5 lore raw

Yes, we make this card.

Here is a link to the mpa3 software for Windows and Wine/Linux including all sources of linux code and the driver fastmpa.ko:

http://www.fastcomtec.com/fwww/supp/mpa3/wmpa3.zip

username: mpa3
password: midas16

Wolfgang Wilhelm

On 18 Sep 2015 at 9:23 Greg KH wrote:

Datum:   	Fri, 18 Sep 2015 09:23:48 -0700
Von:            	Greg KH <[email protected]>
An:             	Wolfgang Wilhelm <[email protected]>
Kopie an:       	[email protected], Austin S Hemmelgarn 

<[email protected]>,
[email protected]
Betreff: Re: problem with "serial" driver in kernel 3.16.0

Quoted 4 lines · Wolfgang Wilhelm

Thankyou very much for your quick answers. I searched now in the linux sources for the problem and I think I could find it in the file linux-source-3.16/drivers/tty/serial/8250/8250_pci.c

Quoted 8 lines

There is a function serial_pci_guessboard and a blacklist including the vendor- and device-ids of 3 softmodems and 2 multi-io cards. I think if the vendor id 0x10e8 (standard AMCC) and device id 0x8226 could be inserted into that blacklist I could load our driver and get the software for our MPA-3 multiparameter system working. It seems that these id's are not really used by any existing serial card, but this guessboard function anyway takes our card as a serial board.

Who makes this card, you? Why is the serial driver grabbing it if it is
not a serial device?

Quoted 1 line

Is this a matter of the Debian distribution or the general linux

kernel?

The kernel is responsible for this, but I would like to see your driver
before marking this device as blacklisted. Do you have a pointer to the
source for it anywhere?

thanks,

greg k-h

#6 lore raw

Problem with USB driver using two devices

In reply to Greg KH

Dear Sir,

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?

With best regards,
Wolfgang Wilhelm
-----
Dr. Wolfgang Wilhelm, FAST ComTec GmbH Gruenwalder Weg 28a, 82041 Oberhaching, Germany Phone +49 89 665180 28, Fax +49 89 665180 40 mailto:[email protected] http://www.fastcomtec.com
Handelsregister Muenchen HRB 73004
General Manager: Dr. Wolfgang Wagner

#7 lore raw

Re: Problem with USB driver using two devices

Quoted 1 line · Wolfgang Wilhelm

Dear Sir,

Hi!

<adding the [email protected] 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.>

Quoted 14 lines

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)

Quoted 7 lines

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

#10 lore raw

Re: Problem with USB driver using two devices

In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 8 lines · Wolfgang Wilhelm

Thankyou very much for the really fast answer.

I don't get any error messages and I can communicate with the driver for the second device via ioctrl and write functions, i.e. write registers and read registers via the RBUF ioctrl function, only the read function for the second device does not work, i.e. no data is obtained from the mcs6_read function for the second device.

Hm, let me go look at the driver again, maybe something's odd with it.

I don't see anything odd with your read function, is it just timing out?

Have you tried doing read/writes from userspace with libusb and that works correctly?

Quoted 4 lines
Quoted 1 line

Which security problems do you see in the code?

No checking that the values given to you by userspace are actually valid and within "sane" ranges :)

Oh, also your ioctl types need to be better specified than "int" as that doesn't make much sense with 64bit kernels and a 32bit userspace. You need to use types like __u32 in order to make sure that works correctly in all situations.

thanks,

greg k-h

#9 lore raw

Re: Problem with USB driver using two devices

In reply to a message not in the archive
Quoted 8 lines · Wolfgang Wilhelm

Thankyou very much for the really fast answer.

I don't get any error messages and I can communicate with the driver for the second device via ioctrl and write functions, i.e. write registers and read registers via the RBUF ioctrl function, only the read function for the second device does not work, i.e. no data is obtained from the mcs6_read function for the second device.

Hm, let me go look at the driver again, maybe something's odd with it.

Quoted 7 lines

Thankyou for your hint using libusb, I will have a look on it.

Our USB device has three endpoints, two with 64 kb packet size for reading and writing registers (I know this is not standard for high speed) and one with 512 kb packet size for reading data. Do you think the problem could arise from this deviation from the USB standard?

No, it should be fine, the USB standard only care about endpoint sizes, not logical "packet" sizes, right?

Quoted 2 lines

Of course we would be happy if our driver could be merged into the Linux kernel.

If you can use libusb, I'd strongly recommend using that and not a kernel driver at all, as we don't like adding kernel drivers where they are not needed.

Quoted 5 lines

Our device uses the same vendor/product id's as a "D-Link DSB-R100 USB FM radio" dsbr100, that has a built-in driver in some Linux distributions, so that dsbr100 must be blacklisted in /etc/modprobe.d/fbdev-blacklist.conf for using our driver.

Does your device work like the USB FM radio device? Why is the same vendor/device id being used here? They are supposed to be unique for different types of devices.

Quoted 1 line

Which security problems do you see in the code?

No checking that the values given to you by userspace are actually valid and within "sane" ranges :)

thanks,

greg k-h