LKML Archive mirror
 help / color / mirror / Atom feed
* problem with "serial" driver in kernel 3.16.0
@ 2015-09-17 13:24 Wolfgang Wilhelm
  2015-09-17 13:54 ` Greg KH
  2015-09-17 20:03 ` Austin S Hemmelgarn
  0 siblings, 2 replies; 10+ messages in thread
From: Wolfgang Wilhelm @ 2015-09-17 13:24 UTC (permalink / raw
  To: stable; +Cc: linux-kernel

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:wilhelm@fastcomtec.com http://www.fastcomtec.com
Handelsregister Muenchen HRB 73004
General Manager: Dr. Wolfgang Wagner



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: problem with "serial" driver in kernel 3.16.0
  2015-09-17 13:24 problem with "serial" driver in kernel 3.16.0 Wolfgang Wilhelm
@ 2015-09-17 13:54 ` Greg KH
  2015-09-17 20:03 ` Austin S Hemmelgarn
  1 sibling, 0 replies; 10+ messages in thread
From: Greg KH @ 2015-09-17 13:54 UTC (permalink / raw
  To: Wolfgang Wilhelm; +Cc: stable, linux-kernel

On Thu, Sep 17, 2015 at 03:24:31PM +0200, Wolfgang Wilhelm wrote:
> 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?

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: problem with "serial" driver in kernel 3.16.0
  2015-09-17 13:24 problem with "serial" driver in kernel 3.16.0 Wolfgang Wilhelm
  2015-09-17 13:54 ` Greg KH
@ 2015-09-17 20:03 ` Austin S Hemmelgarn
  2015-09-18  9:24   ` Wolfgang Wilhelm
  1 sibling, 1 reply; 10+ messages in thread
From: Austin S Hemmelgarn @ 2015-09-17 20:03 UTC (permalink / raw
  To: Wolfgang Wilhelm, stable; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2165 bytes --]

On 2015-09-17 09:24, Wolfgang Wilhelm wrote:
> 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.
> 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?
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).


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: problem with "serial" driver in kernel 3.16.0
  2015-09-17 20:03 ` Austin S Hemmelgarn
@ 2015-09-18  9:24   ` Wolfgang Wilhelm
  2015-09-18 16:23     ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Wilhelm @ 2015-09-18  9:24 UTC (permalink / raw
  To: stable, Austin S Hemmelgarn, Greg KH; +Cc: linux-kernel

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 <wilhelm@fastcomtec.com>, stable@vger.kernel.org
Kopie an:	linux-kernel@vger.kernel.org
Von:	Austin S Hemmelgarn <ahferroin7@gmail.com>
Datum:	Thu, 17 Sep 2015 16:03:52 -0400

On 2015-09-17 09:24, Wolfgang Wilhelm wrote:
> 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.

> 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?

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).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: problem with "serial" driver in kernel 3.16.0
  2015-09-18  9:24   ` Wolfgang Wilhelm
@ 2015-09-18 16:23     ` Greg KH
  2015-09-18 17:52       ` Dr. Wolfgang Wilhelm
  2016-11-23 13:14       ` Problem with USB driver using two devices Wolfgang Wilhelm
  0 siblings, 2 replies; 10+ messages in thread
From: Greg KH @ 2015-09-18 16:23 UTC (permalink / raw
  To: Wolfgang Wilhelm; +Cc: stable, Austin S Hemmelgarn, linux-kernel



On Fri, Sep 18, 2015 at 11:24:05AM +0200, Wolfgang Wilhelm wrote:
> 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.

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

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: problem with "serial" driver in kernel 3.16.0
  2015-09-18 16:23     ` Greg KH
@ 2015-09-18 17:52       ` Dr. Wolfgang Wilhelm
  2016-11-23 13:14       ` Problem with USB driver using two devices Wolfgang Wilhelm
  1 sibling, 0 replies; 10+ messages in thread
From: Dr. Wolfgang Wilhelm @ 2015-09-18 17:52 UTC (permalink / raw
  To: Greg KH; +Cc: stable, Austin S Hemmelgarn, linux-kernel

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 <greg@kroah.com>
An:             	Wolfgang Wilhelm <wilhelm@fastcomtec.com>
Kopie an:       	stable@vger.kernel.org, Austin S Hemmelgarn 
<ahferroin7@gmail.com>,
	linux-kernel@vger.kernel.org
Betreff:        	Re: problem with "serial" driver in kernel 3.16.0



On Fri, Sep 18, 2015 at 11:24:05AM +0200, Wolfgang Wilhelm wrote:
> 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.

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

> 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Problem with USB driver using two devices
  2015-09-18 16:23     ` Greg KH
  2015-09-18 17:52       ` Dr. Wolfgang Wilhelm
@ 2016-11-23 13:14       ` Wolfgang Wilhelm
  2016-11-23 14:57         ` Greg KH
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Wilhelm @ 2016-11-23 13:14 UTC (permalink / raw
  To: Greg KH; +Cc: stable, Austin S Hemmelgarn, linux-kernel

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:wilhelm@fastcomtec.com http://www.fastcomtec.com
Handelsregister Muenchen HRB 73004
General Manager: Dr. Wolfgang Wagner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problem with USB driver using two devices
  2016-11-23 13:14       ` Problem with USB driver using two devices Wolfgang Wilhelm
@ 2016-11-23 14:57         ` Greg KH
       [not found]           ` <5835C11F.28335.C2ECC3B@wilhelm.fastcomtec.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2016-11-23 14:57 UTC (permalink / raw
  To: Wolfgang Wilhelm; +Cc: linux-usb, Austin S Hemmelgarn, linux-kernel

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

Hi!

<adding the linux-usb@vger.kernel.org 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problem with USB driver using two devices
       [not found]           ` <5835C11F.28335.C2ECC3B@wilhelm.fastcomtec.com>
@ 2016-11-23 16:35             ` Greg KH
  2016-11-23 16:39               ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2016-11-23 16:35 UTC (permalink / raw
  To: Wolfgang Wilhelm; +Cc: linux-usb, Austin S Hemmelgarn, linux-kernel

On Wed, Nov 23, 2016 at 05:17:35PM +0100, Wolfgang Wilhelm wrote:
> 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.

> 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?

> 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.

> 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.

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Problem with USB driver using two devices
  2016-11-23 16:35             ` Greg KH
@ 2016-11-23 16:39               ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2016-11-23 16:39 UTC (permalink / raw
  To: Wolfgang Wilhelm; +Cc: linux-usb, Austin S Hemmelgarn, linux-kernel

On Wed, Nov 23, 2016 at 05:35:45PM +0100, Greg KH wrote:
> On Wed, Nov 23, 2016 at 05:17:35PM +0100, Wolfgang Wilhelm wrote:
> > 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?

> > 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-11-23 16:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 13:24 problem with "serial" driver in kernel 3.16.0 Wolfgang Wilhelm
2015-09-17 13:54 ` Greg KH
2015-09-17 20:03 ` Austin S Hemmelgarn
2015-09-18  9:24   ` Wolfgang Wilhelm
2015-09-18 16:23     ` Greg KH
2015-09-18 17:52       ` Dr. Wolfgang Wilhelm
2016-11-23 13:14       ` Problem with USB driver using two devices Wolfgang Wilhelm
2016-11-23 14:57         ` Greg KH
     [not found]           ` <5835C11F.28335.C2ECC3B@wilhelm.fastcomtec.com>
2016-11-23 16:35             ` Greg KH
2016-11-23 16:39               ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).