Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: [SOLVED] Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

  1. #1
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    [SOLVED] Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    I have recently purchased a cheap USB/Serial cable from a supplier on eBay and would like some help getting it recognised by Ubuntu. The cable has no markings but is silver with a turquoise plug at either end.

    I have done quite a lot of investigation through this forum ( and other sources ) but am having a problem when it comes to recompiling a driver.

    It might be best to start at the beginning:

    When the cable is inserted lsusb gives:

    Code:
    Bus 003 Device 001: ID 0000:0000  
    Bus 002 Device 002: ID 1a86:7523  
    Bus 002 Device 001: ID 0000:0000  
    Bus 001 Device 002: ID 047d:101f Kensington PocketMouse Pro
    Bus 001 Device 001: ID 0000:0000
    and dmesg gives:

    Code:
    [ 9632.271712] usb 2-2: new full speed USB device using uhci_hcd and address 2
    [ 9632.675793] usb 2-2: generic converter now attached to ttyUSB0
    you can see that I have followed various threads and got the device attached to /dev/ttyUSB0.

    If I use Minicom and attach the cable to my own build PIC programmer, I can talk to it!! However, it would appear that the default speed is 19.2kbps (the same as my PIC programmer) and devices working at other speeds cannot be seen.

    By scouring the USB vendor and product ID lists I have discovered that this device is a clone of the Winchiphead USB/Serial cable and behaves as an HL-340, although the vendor is "unknown". With this in mind I went back to the internet and discovered that the driver required was for a CH341 so I downloaded the drivers to make this work with 'Windows' and, after much head scratching, finally got the cable to work in this "environment". But I want it to work with Ubuntu!!

    Searching the internet again I came across:

    https://bugs.launchpad.net/ubuntu/+s...ta/+bug/235459

    where Jonathan Ernst has had a similar problem. I also came across:

    http://ubuntuforums.org/showpost.php...0&postcount=27

    where cdcase describes how to compile the CH341 driver.

    Using this information I downloaded ch341.tar.gz and extracted it. I then edited the usb_device_id structure within ch341.c thus:

    Code:
    static struct usb_device_id id_table [] = {
    		{ USB_DEVICE(0x4348, 0x5523) },
    +      		{ USB_DEVICE(0x1a86, 0x7523) },
    		{ },
    	};
    MODULE_DEVICE_TABLE(usb, id_table);
    All seems well so far, but now for the problem!! When I run the makefile I get:

    Code:
    ~/Desktop/CH341$ make
    make -C /lib/modules/2.6.24-19-386/build SUBDIRS=/home/alan/Desktop/CH341 modules
    make: *** /lib/modules/2.6.24-19-386/build: No such file or directory. Stop.
    make: *** [default] Error 2
    It would appear that the directory /build is not there. I am afraid that I am not very knowledgeable about makefiles (all my PIC c programming is done in an IDE that produces them for me).

    So, eventually, here are the questions:

    1. Should the makefile be edited to point to a different directory?

    2. Is there another way to make Ubuntu recognise that device 1a86:7523 should use the CH341 driver?

    Please note that I have been using Ubuntu (any form of Linux or Unix) for about three weeks so have little knowledge of its internals. Any help would be greatly appreciated.
    If at first you don't suck seed, try drier grain!!

  2. #2
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    **Bump**
    If at first you don't suck seed, try drier grain!!

  3. #3
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    How come there's never a guru around when you need one?
    If at first you don't suck seed, try drier grain!!

  4. #4
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Bump
    If at first you don't suck seed, try drier grain!!

  5. #5
    Join Date
    Nov 2006
    Location
    UK
    Beans
    661
    Distro
    Ubuntu Development Release

    Lightbulb Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    I've hopefully made this easy for you. I've created a DKMS (Dynamic Kernel Module Support) package containing the ch341 driver patched to include the device ID 1a86:7523.

    DKMS ensures that if the kernel is updated the module will be automatically rebuilt without user intervention to match the new kernel ABI (Application Binary Interface).

    The package is ch341-dkms. To install it add my Ubuntu PPA (Personal Package Archive) to apt's source list:
    Code:
    sudo sh -c "echo 'deb http://ppa.launchpad.net/intuitivenipple/ubuntu $(lsb_release -sc) main' >/etc/apt/sources.list.d/intuitivenipple.list"
    sudo apt-get update
    and install the package:
    Code:
    sudo apt-get install ch341-dkms
    Now remove my PPA (since you won't want to accidentally upgrade other packages I maintain there):
    Code:
    sudo rm /etc/apt/sources.list.d/intuitivenipple.list
    sudo apt-get update
    To check the supported device IDs:
    Code:
    modinfo ch341
    
    filename:       /lib/modules/2.6.24-21-generic/updates/dkms/ch341.ko
    license:        GPL
    srcversion:     114760D4AECC70A16DA83DF
    alias:          usb:v1A86p7523d*dc*dsc*dp*ic*isc*ip*
    alias:          usb:v4348p5523d*dc*dsc*dp*ic*isc*ip*
    depends:        usbserial,usbcore
    vermagic:       2.6.24-21-generic SMP mod_unload 
    parm:           debug:Debug enabled or not (bool)
    You'll notice the alias v1A86p7523 which in more human-readable form is Vendor 0x1A86 Product 0x7523.

  6. #6
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Quote Originally Posted by IntuitiveNipple View Post
    I've hopefully made this easy for you. I've created a DKMS (Dynamic Kernel Module Support) package containing the ch341 driver patched to include the device ID 1a86:7523.
    etc...

    Many, many thanks for this - I was wondering if a 'Knight on a Shining White Horse' would appear .

    I have tried this, but appear to not to get any changes. Having followed your instructions to the letter (this cut and paste thing is very useful), I noticed the following:
    Code:
    alan@lilputa:~$ sudo apt-get install ch341-dkms
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      python-pexpect libgksu1.2-1 libxine1-x g++-4.2 libxine1-misc-plugins
      libxcb-xv0 libxine1-bin g++ dar libdar64-4 libxine1-ffmpeg libxcb-shape0
      libtimedate-perl dpkg-dev libstdc++6-4.2-dev libxine1-plugins libxvmc1
      pmount libmodplug0c2 libxcb-shm0 libxine1-console
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      dkms
    Recommended packages:
      fakeroot
    The following NEW packages will be installed
      ch341-dkms dkms
    0 upgraded, 2 newly installed, 0 to remove and 23 not upgraded.
    Need to get 61.3kB of archives.
    After this operation, 451kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    WARNING: The following packages cannot be authenticated!
      dkms ch341-dkms
    Install these packages without verification [y/N]? y
    Get: 1 http://ppa.launchpad.net hardy/main dkms 2.0.20.3-0ubuntu1~ppa1h [55.2kB]
    Get: 2 http://ppa.launchpad.net hardy/main ch341-dkms 1.1-0ubuntu1~ppa2h [6062B]
    Fetched 61.3kB in 0s (139kB/s)   
    Selecting previously deselected package dkms.
    (Reading database ... 111625 files and directories currently installed.)
    Unpacking dkms (from .../dkms_2.0.20.3-0ubuntu1~ppa1h_all.deb) ...
    Selecting previously deselected package ch341-dkms.
    Unpacking ch341-dkms (from .../ch341-dkms_1.1-0ubuntu1~ppa2h_all.deb) ...
    Setting up dkms (2.0.20.3-0ubuntu1~ppa1h) ...
    Setting up ch341-dkms (1.1-0ubuntu1~ppa2h) ...
    Loading new ch341-1.1 DKMS files...
    
    Creating symlink /var/lib/dkms/ch341/1.1/source ->
                     /usr/src/ch341-1.1
    
    DKMS: add Completed.
    Installing prebuilt kernel module binaries (if any)
    
    Module build for the currently running kernel was skipped since the
    kernel source for this kernel does not seem to be installed.
    The last three lines (coloured in red) worry me slightly.

    When I try to check the module I still get:

    Code:
    alan@lilputa:~$ modinfo ch341
    filename:       /lib/modules/2.6.24-19-386/kernel/drivers/usb/serial/ch341.ko
    license:        GPL
    srcversion:     823CB9B1C5041DE4C83B53B
    alias:          usb:v4348p5523d*dc*dsc*dp*ic*isc*ip*
    depends:        usbserial,usbcore
    vermagic:       2.6.24-19-386 mod_unload 486 
    parm:           debug:Debug enabled or not (bool)
    This tends to indicate that I still have the old Ch341 driver in place. Am I missing a trick here? Is there something I need to have installed first to make this work? As I have already said, please be aware that my knowledge of Linux internals is very scant.
    If at first you don't suck seed, try drier grain!!

  7. #7
    Join Date
    Nov 2006
    Location
    UK
    Beans
    661
    Distro
    Ubuntu Development Release

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Quote Originally Posted by alanmilne View Post
    Code:
    DKMS: add Completed.
    Installing prebuilt kernel module binaries (if any)
    
    Module build for the currently running kernel was skipped since the
    kernel source for this kernel does not seem to be installed.
    The last three lines (coloured in red) worry me slightly.
    This tends to indicate that I still have the old Ch341 driver in place. Am I missing a trick here? Is there something I need to have installed first to make this work? As I have already said, please be aware that my knowledge of Linux internals is very scant.
    No you haven't missed anything, but I am slightly surprised! This also explains why your attempts to build the module manually failed.

    For a kernel module to build on its own it requires, at a minimum, the header files (include files with declarations, etc.). These are supposed to be installed as part of the standard install. The dkms package depends on them and it has installed. Maybe they've been uninstalled at some point.

    Let's check what is installed. Here's the command with example output from a system with Hardy and recent updates installed:
    Code:
    dpkg-query -W -f='${Package;-35}\t${Version;-15}\t${Status}\n' 'linux-headers*'
    
    linux-headers                      	               	unknown ok not-installed
    linux-headers-2.6                  	               	unknown ok not-installed
    linux-headers-2.6.24-16            	               	purge ok not-installed
    linux-headers-2.6.24-16-generic    	               	purge ok not-installed
    linux-headers-2.6.24-19            	2.6.24-19.41   	install ok installed
    linux-headers-2.6.24-19-generic    	2.6.24-19.41   	install ok installed
    linux-headers-2.6.24-20            	2.6.24-20.38   	install ok installed
    linux-headers-2.6.24-20-generic    	2.6.24-20.38   	install ok installed
    linux-headers-2.6.24-21            	2.6.24-21.42   	install ok installed
    linux-headers-2.6.24-21-generic    	2.6.24-21.42   	install ok installed
    linux-headers-generic              	2.6.24.21.23   	install ok installed
    Doing some exploration it seems even Ubuntu's package-management server doesn't know about these meta packages. I need to dig further.

    For now, try installing the headers matching the running kernel as a stop-gap to get you going:
    Code:
    uname -r
    
    sudo apt-get install linux-headers-$(uname -r)
    If that is successful try re-building ch341-dkms:
    Code:
    sudo dkms install -m ch341 -v 1.1
    If that gets confused, start again from the beginning by removing the package entirely and starting again with my original instructions (adding my PPA first):
    Code:
    sudo dpkg -r ch341-dkms

  8. #8
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Once again, many thanks. I don't know what has happened here, but this is the terminal output from getting these headers.....


    Code:
    alan@lilputa:~$ dpkg-query -W -f='${Package;-35}\t${Version;-15}\t${Status}\n' 'linux-headers*'
    linux-headers                      	               	unknown ok not-installed
    linux-headers-2.6                  	               	unknown ok not-installed
    linux-headers-2.6.24-16            	               	purge ok not-installed
    linux-headers-2.6.24-16-generic    	               	purge ok not-installed
    linux-headers-2.6.24-19            	2.6.24-19.41   	install ok installed
    linux-headers-2.6.24-19-generic    	2.6.24-19.41   	install ok installed
    linux-headers-generic              	2.6.24.19.21   	install ok installed
    
    alan@lilputa:~$ uname -r
    2.6.24-19-386
    
    alan@lilputa:~$ sudo apt-get install linux-headers-$(uname -r)
    [sudo] password for alan: 
    
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following NEW packages will be installed
      linux-headers-2.6.24-19-386
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 642kB of archives.
    After this operation, 7418kB of additional disk space will be used.
    Get: 1 http://gb.archive.ubuntu.com hardy-updates/main linux-headers-2.6.24-19-386 2.6.24-19.41 [642kB]
    Fetched 642kB in 1s (540kB/s)                       
    Selecting previously deselected package linux-headers-2.6.24-19-386.
    (Reading database ... 110555 files and directories currently installed.)
    Unpacking linux-headers-2.6.24-19-386 (from .../linux-headers-2.6.24-19-386_2.6.24-19.41_i386.deb) ...
    Setting up linux-headers-2.6.24-19-386 (2.6.24-19.41) ...
    Examining /etc/kernel/header_postinst.d.
    run-parts: executing /etc/kernel/header_postinst.d/dkms
     * Running DKMS auto installation service for kernel 2.6.24-19-386                                                           
     *  ch341 (1.1)...                                                                                                           ch341 (1.1): Installing module.
    ...........
    ............
                                                                                                                          [ OK ]
    
    alan@lilputa:~$ modinfo ch341
    filename:       /lib/modules/2.6.24-19-386/updates/dkms/ch341.ko
    license:        GPL
    srcversion:     114760D4AECC70A16DA83DF
    alias:          usb:v1A86p7523d*dc*dsc*dp*ic*isc*ip*
    alias:          usb:v4348p5523d*dc*dsc*dp*ic*isc*ip*
    depends:        usbserial,usbcore
    vermagic:       2.6.24-19-386 mod_unload 486 
    parm:           debug:Debug enabled or not (bool)
    It would appear that the package built itself once the headers were installed. Now all I have to do is try the cable and see what happens!!

    Am I correct in my assumption that Linux Headers are similar to the <*.h> files used in c programming, and link the calls required into the kernel?
    If at first you don't suck seed, try drier grain!!

  9. #9
    Join Date
    Sep 2008
    Location
    Reading, UK
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Thought you might like to see this as well:

    Code:
    alan@lilputa:~$ dmesg | grep USB
    [   19.425593] USB Universal Host Controller Interface driver v3.0
    [   19.426325] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 1
    [   19.426666] hub 1-0:1.0: USB hub found
    [   19.530867] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 2
    [   19.531171] hub 2-0:1.0: USB hub found
    [   19.634854] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 3
    [   19.635158] hub 3-0:1.0: USB hub found
    [   19.770168] usb 1-1: new low speed USB device using uhci_hcd and address 2
    [   21.505887] input,hidraw0: USB HID v1.10 Mouse [Kensington Kensington PocketMouse Pro] on usb-0000:00:1d.0-1
    [   21.505937] /build/buildd/linux-2.6.24/drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
    [   45.508240] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
    [   45.508272] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial Driver core
    [13554.827881] usb 2-2: new full speed USB device using uhci_hcd and address 2
    [13555.141060] usb 2-2: generic converter now attached to ttyUSB0
    [13555.194224] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for ch341-uart
    [13622.565435] usb 2-2: USB disconnect, address 2
    [13622.566130] generic ttyUSB0: generic converter now disconnected from ttyUSB0
    [13642.447989] usb 2-2: new full speed USB device using uhci_hcd and address 3
    [13642.685296] usb 2-2: ch341-uart converter now attached to ttyUSB0
    If at first you don't suck seed, try drier grain!!

  10. #10
    Join Date
    Nov 2006
    Location
    UK
    Beans
    661
    Distro
    Ubuntu Development Release

    Re: Clone Winchiphead USB/Serial cable (1a86:7523). Help needed with Makefile.

    Quote Originally Posted by alanmilne View Post
    It would appear that the package built itself once the headers were installed. Now all I have to do is try the cable and see what happens!!

    Am I correct in my assumption that Linux Headers are similar to the <*.h> files used in c programming, and link the calls required into the kernel?
    Exactly. The kernel is written in C, so to build modules requires the headers (modules are part of the kernel even if built separately). You can inspect the files the package installs by doing (warning, a lot of output will result):
    Code:
    dpkg-query -L linux-headers-$(uname -r)

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •