# Ubuntu – Can’t open port /dev/ttyUSB0

usb-installation

I have two PICAXE microcontrollers. Actually, I have Ubuntu 14.04 LTS (Trusty Tahr).

sudo apt-get install libgtk2.0-0: libcairo2 i386: i386 libpango1.0-0: libgdk-pixbuf2.0-0 i386: i386 libstdc ++ 6: i386


I followed these instructions:

4.0) Linux Installation

The AXE027 cable contains an internal electronic circuit, based upon an FTDI USB-to-serial converter chip. This chip is already supported by the default Linux installation, via the kernel driver named ‘ftdi_sio’ (kernel 2.4.20 and later). Therefore no driver download is required.

However, as many different products from many different companies all use the same FTDI chip, each product is given a unique ‘product id’ number for identification purposes.

This unique product id is programmed into the chip inside the cable, so that when the cable is connected to the computer it can be uniquely identified.

The unique product id for the AXE027 USB cable is 0xbd90. The vendor id is 0x0403. However the default driver, ftdi_sio, as installed by most Linux distributions, only recognises a couple of (default) product ids for the FTDI chip (e.g. 0x6001). Therefore it is required to ‘patch’ the driver so that it correctly supports the AXE027’s 0xbd90 product id.

All three options are checked for correct operation in the same simple way – after inserting the AXE027 cable into the USB port the symbolic link file called /dev/ttyUSB0 should automatically appear within the operating system.

Note that any application using the AXE027 cable needs to address this USB symbolic link:

/dev/ttyUSB0

Which is not the same as the traditional serial (e.g. “COM1”) port link:

/dev/ttyS0

4.2) Linux Patch Option 2 (recommended)
Create a new udev rule, so that the modprobe rule is automatically applied every time the computer boots. Create a new file (e.g. using KWrite, gedit or similar text editor) named:

/etc/udev/rules.d/99-axe027.rules


To do this, open a Terminal console and then type:

sudo kwrite /etc/udev/rules.d/99-axe027.rules


Then enter the following text (note the last two lines below should be entered as one long line) and then save the file.

# /etc/udev/rules.d/99-axe027.rules
# contains axe027 udev rule to patch default
# FTDI product id to AXE027 product id (0xbd90)
SYSFS{idProduct}=="bd90",
SYSFS{idVendor}=="0403",
RUN+="/sbin/modprobe -q ftdi_sio product=0xbd90 vendor=0x0403"


The new rule will then always be applied when the system boots. To immediately try out the new rule without rebooting open a Terminal console and then type:

(Original code)

sudo udevcontrol reload_rules


(My Code)

sudo udevadm control --reload-rules


Then, I tried to execute the LinAXEpad application, accessing to:
VIEW>>OPTIONS (choose the microcontroller), and finally "click" on FIRMWARE

I got this:

Can't open port /dev/ttyUSB0
(err=2: No such file or directory)

What can I do?

Trying with LSUSB: http://www.subirimagenes.com/otros-lsusb-9076605.html

Trying with DMESG: http://www.subirimagenes.com/otros-dmesg-9076607.html

dmesg gives you some useful tips (see the picture you posted).

• Your rule for udev must be incorrect: see the lines where ftdi_sio tells the parameters are unknown/ignored. Anyway, loading this module has some result: your adapter is now known as a serial adapter and the ttyUSB0 created, but it is said the driver is experimental and you should ask linux-usb@vger.kernel.org to add your adapter to a correct driver (I would do that in your place, it's most probably the better way to go).

Now, about the permission denied, you could:

• list the /dev folder with ls -l to find the group owning the ttyUSB0. (probably tty). It should have rw permission on it.
• make the user running your app member of this group, for instance with sudo adduser theuser thegroup. It should fix the permission problem.

And BTW, when the output of a command like modprobe -c is too large, you can either pipe it to less or to grep:

sudo modprobe -c | less

sudo modprobe -c | grep ftdi_sio