Author Topic: Cannot compile a patched driver in LinuxMCE kernel 2.6.22-14-generic #1 SMP  (Read 4952 times)

domanows

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Can anyone give me a hint on how to compile a driver (the pl2303 usb/serial cable driver) from the kernel source for linuxmce?

Here is what I did
1. Get the kernel source apt-get linux-src and untar into /usr/src
2. Get the kernel patch linux-2.6-pl2303.patch and put it in /usr/src
3. Apply the patch patch -p1 < ../linux-2.6-pl2303.patch
4. Fast config the kernel  make allmodconfig
5. Prepare modules make modules_prepare
6. cd drivers/usb/serial/
7. Make the module make -C /usr/src/linux-source-2.6.22 M=$(pwd)
8 cp the new module to /lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/

while I try to modprobe the pl2303.ko module, I get the following error

dcerouter_103356:/lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial# modprobe pl2303
FATAL: Error inserting pl2303 (/lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/pl2303.ko): Invalid module format

Its been years since I have compiled a kernel (RPMS have made me lazy). 
Input would be greatly appreciated.  This is the last step to getting the MythTV portion of LinuxMCE working.

Matt

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
the pl2303 driver is included in the kernel for ages... you should not need to compile it manually.

Regarding the loading error, please see if there are any error lines in the "dmesg" output. Please also provide the output of "file /lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/pl2303.ko"

br, Hari
rock your home - http://www.agocontrol.com home automation

domanows

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Hari,

Here is what I get in dmesg when I load the original driver
[423611.791169] usbcore: registered new interface driver pl2303
[423611.791174] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver

So it does load.  Here is the problem though, when I plug the cable into my LinuxMCE box, I get the following output
Jan 26 11:03:33 dcerouter kernel: [423757.629304] usb 1-1: new full speed USB device using uhci_hcd and address 6
Jan 26 11:03:33 dcerouter kernel: [423757.787158] usb 1-1: configuration #1 chosen from 1 choice

Once the cable is plugged in, I do not get a /dev/ttyUSB* device
dcerouter_103356:/var/log# ls -lt /dev/ttyUSB*
ls: /dev/ttyUSB*: No such file or directory

I then tried plugging the cable into my FC9 laptop, and I get
Jan 26 11:05:29 neo kernel: hub 1-0:1.0: unable to enumerate USB device on port 4
Jan 26 11:05:29 neo kernel: usb 3-2: new full speed USB device using uhci_hcd and address 6
Jan 26 11:05:29 neo kernel: usb 3-2: configuration #1 chosen from 1 choice
Jan 26 11:05:29 neo kernel: pl2303 3-2:1.0: pl2303 converter detected
Jan 26 11:05:29 neo kernel: usb 3-2: pl2303 converter now attached to ttyUSB0
Jan 26 11:05:29 neo kernel: usb 3-2: New USB device found, idVendor=05ad, idProduct=0fba
Jan 26 11:05:29 neo kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jan 26 11:05:29 neo kernel: usb 3-2: Product: USB-Serial Controller
Jan 26 11:05:29 neo kernel: usb 3-2: Manufacturer: Prolific Technology Inc.

and the USB Serial device pops up
[root@neo ~]# ls /dev/ttyUSB0
/dev/ttyUSB0

After doing some research online, I found that there was a bug in the pl2303 driver as of 7/08.  The reference is at http://bugs.centos.org/view.php?id=2954

So since the cable works with the 2.6.25.4-30 kernel and not the 2.6.22-14, I can only believe that the patch was applied in the more recent kernel.
Also, the module size is different

linuxmce@dcerouter:~$ ls -l /lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/pl2303.ko
-rw-r--r-- 1 root root 30280 2009-01-26 11:01 /lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/pl2303.ko

Versus

[domanows@neo Desktop]$ ls -l /lib/modules/2.6.25.4-30.fc9.i686/kernel/drivers/usb/serial/pl2303.ko
-rwxr--r-- 1 root root 25152 2008-05-21 18:40 /lib/modules/2.6.25.4-30.fc9.i686/kernel/drivers/usb/serial/pl2303.ko

Your thoughts would be appreciated. 
Matt




hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
ok, makes sense.

Maybe you want to give feedback on my two questions from the last post..

br, Hari
rock your home - http://www.agocontrol.com home automation

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Are there other new /dev/tty* files?
"Change is inevitable. Progress is optional."
-- Anonymous


colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
All I can tell you is that I am using a converter cable that uses exactly the same chip, and it works fine, as you can see here:

Code: [Select]
linuxmce@dcerouter:/lib/modules/2.6.22-14-generic$ sudo lsusb -vd 0557:2008
[sudo] password for linuxmce:

Bus 005 Device 002: ID 0557:2008 ATEN International Co., Ltd UC-232A Serial Port [pl2303]
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0557 ATEN International Co., Ltd
  idProduct          0x2008 UC-232A Serial Port [pl2303]
  bcdDevice            3.00
  iManufacturer           1 Prolific Technology Inc.
  iProduct                2 USB-Serial Controller D
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x000a  1x 10 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

domanows

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Here is all I get out of an lsusb

dcerouter_103356:~# lsusb
Bus 001 Device 007: ID 05ad:0fba Y.C. Cable U.S.A., Inc.
Bus 001 Device 001: ID 0000:0000 
Bus 005 Device 004: ID 058f:6362 Alcor Micro Corp.
Bus 005 Device 001: ID 0000:0000 
Bus 004 Device 001: ID 0000:0000 
Bus 003 Device 001: ID 0000:0000 
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 001: ID 0000:0000 

Here is the relevant dmesg
[448398.998077] usb 1-1: new full speed USB device using uhci_hcd and address 7
[448399.159848] usb 1-1: configuration #1 chosen from 1 choice

I do not get any new tty*, /dev/ttyS0 is my X10 Controller attached to an actual serial port

dcerouter_103356:~# ls -lt /dev/tty* | more
crw-rw-rw- 1 root root    5,   0 2009-01-26 17:54 /dev/tty
crw-rw---- 1 root dialout 4,  64 2009-01-26 17:20 /dev/ttyS0
crw-rw---- 1 root root    4,   8 2009-01-21 13:01 /dev/tty8
crw------- 1 root root    4,   1 2009-01-21 13:01 /dev/tty1
crw------- 1 root root    4,   2 2009-01-21 13:01 /dev/tty2

I also do not get any usb devs
dcerouter_103356:~# ls -lt /dev/ttyU*
ls: /dev/ttyU*: No such file or directory
dcerouter_103356:~#

Any thoughts?  This is driving me nuts.  It seems we have the same cable and LinuxMCE.  Mine is just stupider than yours :)

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
I would imagine that the Y.C.Cable USA Inc is the cable, and so although you are using the same chip, it is a different cable and manufacturer. This isn't the end of the world cos the chip should work just the same. But because the product and manuf. IDs are different this could mean it loads a different driver or something. Try:

lsusb -vd 05ad:0fba

and see if much of it matches my output...

Also try:

lsmod |grep 2303

if it is there, you should see it dependent on usbserial and usbcore. Then try:

modinfo pl2303

I get output like this:

Code: [Select]
linuxmce@dcerouter:/lib/modules/2.6.22-14-generic$ modinfo pl2303
filename:       /lib/modules/2.6.22-14-generic/kernel/drivers/usb/serial/pl2303.ko
license:        GPL
description:    Prolific PL2303 USB to serial adaptor driver
srcversion:     D272FA994C5A29D36FF98E4
alias:          usb:v11ADp0001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F6p2001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v12D1p1001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v058Fp9720d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v050Dp0257d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0731p2003d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0E55p110Bd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0413p2101d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v079Bp0027d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v10B5pAC70d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v078Bp1234d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0745p0001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F5p0005d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F5p0004d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F5p0003d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F5p0001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v04E8p8001d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v11F7p02DFd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v6189p2068d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0731p0528d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1453p4026d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v2478p2008d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0584pB000d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0DF7p0620d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0EBAp2080d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0EBAp1080d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v056Ep5004d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v056Ep5003d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0547p2008d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0557p2008d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v04BBp0A03d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v067BpAAA0d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v067BpAAA2d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v067Bp1234d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v067Bp04BBd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v067Bp2303d*dc*dsc*dp*ic*isc*ip*
depends:        usbserial,usbcore
vermagic:       2.6.22-14-generic SMP mod_unload 586
parm:           debug:Debug enabled or not (bool)


As I understand it, the "alias:" lines indicate the unique identifiers of any hardware that can be driven by this driver. You will see part of the way down usb:v0557p2008d - note that is the exact number for my cable ie 0557:2008 (manufacturer:product)... but your's doesn't appear in there. So effectively, when the kernel scans your cable it finds a unique identifier that doesn't match any module it can load.... hence it doesn't work.

First, try looking on their web site for a linux driver. Failing that, look up on the wiki for "unrecognised NIC" and "r8168" these two articles talk about how to recompile a driver/module after changing the identifiers that the kernel should match against. I you download the source for the pl2303 driver, then use the same principles (usb instead of pci in that article) to add in an extra alias: row that matches your unique identifier and recompile, then replace the existing driver (use modprobe to remove the module first, then rename it, move your new one into that directory, then modprobe it back into the kernel) and hopefully that will then work.

Does that make sense?
« Last Edit: January 27, 2009, 03:27:33 am by colinjones »

domanows

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Awesome!  The one step I missed was
cp /boot/config-2.6.22-14-generic .config.  I was executing a make all modules which made the kernel perform differently.
You are the man!