Robert Heller
2018-Apr-27 02:13 UTC
[CentOS] Question about "generic" USB <=> Serial Port kernel drivers...
OK, I am running CentOS 6 on my Laptop and Desktop, presently kernel version 2.6.32-696.20.1.el6.x86_64 (yes, a version or so out of date -- I'll probably do an update soon -- non-trivial since my Internet connection is via dialup). I recently bought a couple of Adafruit Arduino compatibles, a Flora and a Metro 328. Hooking up the Flora and the Metro to a Raspberry Pi running Raspbian (kernel 4.9.35-v7+), tells me that the Metro 328's USB uses a FTDI USB serial interface (ftdi_sio.ko) and the Flora uses the cdc_acm (cdc-acm.ko) USB serial interface. Both of these drivers are available with CentOS 6's kernel, but since Adafruit uses their own Vendor & Product IDs and my (old) kernel's ftdi_sio and cdc-acm drivers don't have Adafruit Vendor & Product IDs, the drivers don't automagically connect. The ftdi_sio has parameters for the Vendor & Product IDs, and specifing the product ID for the Metro 328 allows the driver to latch onto the Metro 328's USB connect and things work (I get a /dev/ttyUSB0 device). The cdc-acm does not have any parameters and I don't see any way to get it to connect. I am pretty sure all Adafruit did was change the programming of the USB chip to have their Vendor & Product IDs and the driver should work (the FTDI one does, once the Vendor & Product IDs are passed to it). My question: since the cdc-acm is not parameterized, I am guessing I need to get the kernel module source (from RH's kernel source RPM? Or maybe Elrepo has it?), hack in the Adafruit Vendor & Product IDs into its table of Vendor & Product IDs and recompile it. Is this correct? Also: is there some "trick" that allows me to create a kernel module that will work with kernel updates, without having to re-compile it after every kernel update? -- Robert Heller -- 978-544-6933 Deepwoods Software -- Custom Software Services http://www.deepsoft.com/ -- Linux Administration Services heller at deepsoft.com -- Webhosting Services
Phil Perry
2018-Apr-27 10:42 UTC
[CentOS] Question about "generic" USB <=> Serial Port kernel drivers...
On 27/04/18 03:13, Robert Heller wrote:> OK, I am running CentOS 6 on my Laptop and Desktop, presently kernel version > 2.6.32-696.20.1.el6.x86_64 (yes, a version or so out of date -- I'll probably > do an update soon -- non-trivial since my Internet connection is via dialup). > > I recently bought a couple of Adafruit Arduino compatibles, a Flora and a > Metro 328. Hooking up the Flora and the Metro to a Raspberry Pi running > Raspbian (kernel 4.9.35-v7+), tells me that the Metro 328's USB uses a FTDI > USB serial interface (ftdi_sio.ko) and the Flora uses the cdc_acm (cdc-acm.ko) > USB serial interface. Both of these drivers are available with CentOS 6's > kernel, but since Adafruit uses their own Vendor & Product IDs and my (old) > kernel's ftdi_sio and cdc-acm drivers don't have Adafruit Vendor & Product > IDs, the drivers don't automagically connect. The ftdi_sio has parameters for > the Vendor & Product IDs, and specifing the product ID for the Metro 328 > allows the driver to latch onto the Metro 328's USB connect and things work (I > get a /dev/ttyUSB0 device). The cdc-acm does not have any parameters and I > don't see any way to get it to connect. I am pretty sure all Adafruit did was > change the programming of the USB chip to have their Vendor & Product IDs and > the driver should work (the FTDI one does, once the Vendor & Product IDs are > passed to it). > > My question: since the cdc-acm is not parameterized, I am guessing I need to > get the kernel module source (from RH's kernel source RPM? Or maybe Elrepo has > it?), hack in the Adafruit Vendor & Product IDs into its table of Vendor & > Product IDs and recompile it. Is this correct? Also: is there some "trick" > that allows me to create a kernel module that will work with kernel updates, > without having to re-compile it after every kernel update? > >Yes, that would be my starting point. If you are sure the drivers just need the vendor & Product device IDs, I would take the CentOS driver code, patch in the required device IDs and build it as a kmod package. kmod packages on Red Hat take advantage of Red Hat's stable kernel ABI and as such do not need to be recompiled for each and every kernel update. They do _sometimes_ break if the driver uses a kernel symbol not on Red Hat's stable kABI whitelist AND Red Hat updates that ABI during a kernel update which can occasionally happen at point releases, but unlikely now given the age of el6. If that happens then we just need to rebuild the kmod against the newer kernel and we are normally good to go. If you wish to proceed down this route then please register and file an RFE at elrepo.org/bugs and we can look at this for you. Alternatively, there is the CentOS-Plus kernel, where CentOS provide some patches to enhance the standard RHEL kernel offering, without breaking compatibility. As this is a simple patch to add device IDs, Akemi could add support for your devices to the CentOS-Plus kernel and you could switch to using the CentOS-Plus kernel and receive automatic updates via CentOS. If you wish to take this route you should file a bug against the CentOS Plus kernel on the CentOS bug tracker and Akemi will take care of it for you. Please feel free to discuss further here if required. Phil