Author Topic: Making a USB device driver  (Read 10707 times)

jjman23

  • Guest
Making a USB device driver
« on: July 26, 2010, 11:34:10 pm »
I have a USB to serial device that I\'d like to use with my GadgetPC.  I have the source code for the manufacturer\'d linux driver. Is there a source code and make guide for the ftdi driver provided with the GadgetPC? If not, can someone point me to a good example on the internet that would point me in the right direction?

Thanks

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Making a USB device driver
« Reply #1 on: July 27, 2010, 01:45:06 am »
FTDI driver is a part of Linux kernel
GadgetPC realease provides ftdi_sio.ko module

jjman23

  • Guest
Re: Making a USB device driver
« Reply #2 on: July 27, 2010, 02:24:43 pm »
I see... I guess I\'ll start with trying to use the 2.6 kernel as described in the debian install guide.  The driver seems to need many linux kernel header files such as kernel.h and usb.h so hopefully I find those in the package that I downloaded at the bipom ftp site.

jjman23

  • Guest
Re: Making a USB device driver
« Reply #3 on: July 28, 2010, 02:19:31 pm »
good news. it seems that I can configure the kernel provide by bipom to use the CP210X driver which is exactly the one I wanted to implement.  I noticed that it wasn\'t part of the modules30.sh copy block so I added it and hopefully it will work then!

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Making a USB device driver
« Reply #4 on: July 28, 2010, 03:28:02 pm »
nice  :)

jjman23

  • Guest
Re: Making a USB device driver
« Reply #5 on: July 29, 2010, 10:43:39 am »
Yes! I now have the CP210X driver module recognizing my usb device.  I had to do a couple tasks manually though.

1. After including the CP210X driver in the ./sh/linux30.sh configuration menu, I had to add a copy line to ./sh/modules30.sh to also copy cp210x.ko to the drivers directory.

2. However, this didn\'t make it visible anymore on the GadgetPC system after booting.  So, I copied the cp210x.ko file to the DebianFS root system under \'/lib/modules/drivers/\' and \'/lib/modules/2.6.30.4/\' and \'/lib/modules/2.6.../kernel/drivers/usb/serial/\' (it was probably only needed in one place though.

3.  On the GadgetPC box I entered the following after booting:

cd /lib/modules/drivers
insmod usbserial.ko (for some reason I don\'t have it loading at boot time anymore).
insmod cp210x.ko

and voila, it worked.

Now I\'m wondering how I get it to load during bootup.  I read that you should add it to /etc/modules but this file doens\'t exist.  Can I just create it and add the modules I want it to load?

Thanks

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Making a USB device driver
« Reply #6 on: July 30, 2010, 01:23:56 am »
Quote
it was probably only needed in one place
It is necessary to copy only to /lib/modules/2.6.30.4/

Did you execute \'depmod -a\' ?

In case of Debian a driverĀ  has to be loaded automatically
as soon as the system detects the device in system.


« Last Edit: July 30, 2010, 01:24:37 am by vitaliy »

jjman23

  • Guest
Re: Making a USB device driver
« Reply #7 on: July 30, 2010, 10:43:11 am »
You\'re right, that seems to be the key.  I\'ll try using \'depmod -a 2.6.30.4\'  as it seems that you need to include the kernel version.  Thanks

jjman23

  • Guest
Re: Making a USB device driver
« Reply #8 on: August 05, 2010, 02:44:02 pm »
I tried the depmod -a and it seems to work so far. Thanks