How to enable usb drivers in linux development tools? Topic is solved

If you have a simple question and just want an answer.
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

How to enable usb drivers in linux development tools?

Post by sethu_jangala »

View Solution
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Post by sethu_jangala »

USB driver support is provided natively on Linux.

The method required to enable the driver, however, depends on the distribution you are using and the kernel version.

Which distributions support USBFS?Known to provide USBFS support:

  • Ubuntu 9.04 or older
  • Ubuntu 9.10 with kernel 2.6.31-19-server
  • CentOS 4.8
  • CentOS 5.4
  • Generally, any distribution with kernel version < 2.6.32
Known to NOT provide USBFS support:

  • Ubuntu 10.04
  • Generally, any distribution with kernel version >= 2.6.32
Method 1 : USBFS supportIf your distribution provides usbfs support then the following command will work:

Code: Select all

mount -t usbfs none /proc/bus/usb -o devmode=0666
To make this change permanent, make sure the following line is in the /etc/fstab file :

Code: Select all

none /proc/bus/usb usbfs defaults,devmode=0666 0 0
This will then automatically mount on boot.

Once the /etc/fstab addition is made, a simple command should work to mount the usbfs filesystem:

Code: Select all

mount /proc/bus/usb
Both the FTDI/XTAG and XTAG-2 debug adapters should work now.

Method 2 : No USBFS supportTo ensure that the permissions are correct on the device when plugging in either an FTDI/XTAG or XTAG-2 debug adapter, you need to configure `udev' to recognise the device.

Create a file "/etc/udev/rules.d/99-xmos.rules" with the following contents:

Code: Select all

SUBSYSTEM!="usb|usb_device", GOTO="xmos_rules_end"ACTION!="add", GOTO="xmos_rules_end"# 20b1:f7d1 for xmos xtag2ATTRS{idVendor}=="20b1", ATTRS{idProduct}=="f7d1", MODE="0666", SYMLINK+="xtag2-%n"# 20b1:f7d3 for xmos startkitATTRS{idVendor}=="20b1", ATTRS{idProduct}=="f7d3", MODE="0666", SYMLINK+="startkit-%n"# 0403:6010 for XC-1 with FTDI dual-uart chipATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", SYMLINK+="xc1-%n"LABEL="xmos_rules_end"
Note: The ATTRS, MODE and SYMLINK stanzas must be all on one line, as each rule can only be on one line.

Now tell udev to reload to ensure the new rules file is added:

Code: Select all

service udev reload
It is also necessary to unplug and re-plug the USB cable to allow udev to recognise the device with the new rules. Alternatively trigger a re-plug in udev with either the "udevadm trigger" or "udevtrigger" command, depending on the version of udev in your Linux distribution.

FTDI/XTAG additional notesThe FTDI library requires that the USB device files are available from /proc/bus/usb and does not support /dev/bus/usb as a location for the files.

However, if your distribution does not support USBFS (for Method 1 above) but does have a /proc/bus/usb empty directory, you can use the following bind mount command as a workaround:

Code: Select all

mount --bind /dev/bus/usb /proc/bus/usb
If your distribution does not support USBFS and also does not have a /proc/bus/usb directory (this is the case on newer kernels, from approximately 2.6.32 onwards) then contact XMOS for unofficial patched version of rthe device library; send XMOS a support ticket which includes "Linux FTDI Library Request" in the subject.

Choughtosh
Member++
Posts: 22
Joined: Thu Apr 10, 2014 9:39 am

Post by Choughtosh »

To configure udev to recognise XTAG 3 use the following 99-xmos.rules contents :

SUBSYSTEM!="usb|usb_device", GOTO="xmos_rules_end"
ACTION!="add", GOTO="xmos_rules_end"

# 20b1:f7d1 for xmos xtag2
ATTRS{idVendor}=="20b1", ATTRS{idProduct}=="f7d1", MODE="0666", SYMLINK+="xtag2-%n"

# 20b1:f7d4 for xmos xtag3
ATTRS{idVendor}=="20b1", ATTRS{idProduct}=="f7d4", MODE="0666", SYMLINK+="xtag3-%n"

# 20b1:f7d3 for xmos startkit
ATTRS{idVendor}=="20b1", ATTRS{idProduct}=="f7d3", MODE="0666", SYMLINK+="startkit-%n"

# 0403:6010 for XC-1 with FTDI dual-uart chip
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", SYMLINK+="xc1-%n"

LABEL="xmos_rules_end"
Choughtosh
Member++
Posts: 22
Joined: Thu Apr 10, 2014 9:39 am

Post by Choughtosh »

You can also use the setup_xmos_devices.sh in the scripts directory of the installation to configure udev.