ftdi_sio device does not work correctly as a normal user

Bug #198757 reported by Wouter Horré
2
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: udev

Some information about my system:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"

The version of udev installed:
$ apt-cache policy udev
udev:
  Installed: 113-0ubuntu17

Problem description:

I have an usb to rs-232 convertor with an FTDI chip (ftdi_sio kernel module). With the standard permissions set by udev, this device is not working correctly as a normal user.

For example, if I am trying to program a micaZ sensor node with uisp:

$ make micaz install,17 mib510,/dev/ttyUSB0
<snip>
    installing micaz binary using mib510
uisp -dprog=mib510 -dserial=/dev/ttyUSB0 --wr_fuse_h=0xd9 -dpart=ATmega128 --wr_fuse_e=ff --erase --upload if=build/micaz/main.srec.out-17 --verify
Firmware Version: .
Failed to enter programming mode.
make: *** [program] Error 2

When I issue the same command as root, everything works as expected:
$ sudo /home/wouterh/local/tos2/bin/uisp -dprog=mib510 -dserial=/dev/ttyUSB0 --wr_fuse_h=0xd9 -dpart=ATmega128 --wr_fuse_e=ff --erase --upload if=build/micaz/main.srec.out-17 --verify
Firmware Version: 2.1
Atmel AVR ATmega128 is found.
Uploading: flash
Verifying: flash

Fuse High Byte set to 0xd9

Fuse Extended Byte set to 0xff

Solution:

I have changed the following line in /etc/udev/rules.d/40-permissions.rules:
SUBSYSTEM=="usb_device", MODE="0664"
to
SUBSYSTEM=="usb_device", GROUP="plugdev", MODE="0664"

and restarted udev, and now everything is working as expected:
$ /home/wouterh/local/tos2/bin/uisp -dprog=mib510 -dserial=/dev/ttyUSB0 --wr_fuse_h=0xd9 -dpart=ATmega128 --wr_fuse_e=ff --erase --upload if=build/micaz/main.srec.out-17 --verify
Firmware Version: 2.1
Atmel AVR ATmega128 is found.
Uploading: flash
Verifying: flash

Fuse High Byte set to 0xd9

Fuse Extended Byte set to 0xff

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Serial ports, even converted ones, should probably be in the "dialout" group (just like ttyS*). In theory, this should work already -- your device should have a ttyUSB0 device set up from the "tty" subsystem, and you should be able to access this.

It looks to me like your program might be trying to communicate with the converter directly (rather than to the converter's serial port?) The rule you tried would only affect the /dev/bus/usb device, which is not normally used for serial communication.

What does the program do? Is it some kind of firmware uploader or settings changing program?

Could you do the following for me:
 1) unplug the device and wait a few seconds
 2) run from a terminal: sudo udevmonitor -e > /tmp/udev.log
 3) plug the device in, and wait a few seconds
 4) stop the command
 5) attach the resulting /tmp/udev.log file to this bug report

Thanks

Changed in udev:
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Wouter Horré (wouterh) wrote :

The device works correctly if used for a serial console.

uisp is indeed a firmware uploader and does not work without the correct permissions on the /dev/bus/usb device.

I do not claim the workaround I described is the correct one. It should probably be more fine grained and probably use the "dialout" group.

I have attached the udev.log file as requested (generated with the workaround reverted).

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Do the following rules work for you?

SUBSYSTEM=="usb_device", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0660", GROUP="dialout"

Revision history for this message
Wouter Horré (wouterh) wrote :

I have tested your rules and I can confirm that they work.

Changed in udev:
status: Incomplete → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 117-5

---------------
udev (117-5) hardy; urgency=low

  * Merge the "volumeid" package back into "udev", there is no particular
    gain to it being a separate binary package and it prevents the upgrade
    from dapper from migrating the fstab to UUID. LP: #209347.

  * debian/patches/00-git-bad-net-rules.patch:
    - Upstream patch from 118 to avoid creating persistent net rules
      which will match any device.
  * debian/patches/01-git-squashfs-lzma.patch:
    - Upstream patch from 118 to detect LZMA-compressed squashfs.
  * debian/patches/02-git-squashfs-endian.patch:
    - Upstream patch from 118 to detect endianness of LZMA squashfs.
  * debian/patches/03-git-vol_id-timeout-once.patch:
    - Upstream patch from 118 to only timeout once for unreadable devices.
      LP: #156184.
  * debian/patches/04-git-multiple-floppy-devices.patch:
    - Upstream patch from 118 to fix create_floppy_devices for more than
      one floppy device. Possibly LP: #132546.
  * debian/patches/05-git-vol_id-probe_all-readable.patch:
    - Upstream patch from 118 to check whether a device is readable before
      probing. Also LP: #156184.
  * debian/patches/00upstream-RUN-for-remove.patch:
    - Rename to 06-git-run-for-remove.patch so its in series with other
      git patches (this is from 119)
  * debian/patches/07-git-unlock-write_net_rules.patch:
    - Upstream patch from 119 to unlock rules after invalid match, correcting
      a bug introduced by 00-git-bad-net-rules.patch
  * debian/patches/08-git-vol_id-uuid-buffer.patch:
    - Upstream patch from 119 to correct UUID raw buffer usage.
  * debian/patches/09-git-update-ext.patch:
    - Upstream patch from 119 to update ext filesystem detection.
  * debian/patches/10-git-match-basename.patch:
    - Upstream patch from 119 to add match on the basename of an interface
      so we can deal with PS3 multiple interfaces with the same MAC.
  * debian/patches/11-git-persistent-change.patch:
    - Upstream patch from 119 to run persistent device rules on change
      events.
  * debian/patches/12-git-serialise-same-devno.patch:
    - Upstream patch from git to serialise multiple events with the same
      device number, fixes a race with serial ttys amongst other things.

  * 20-names.rules:
    - Add missing quotes for infiniband rules. LP: #192552.
    - Change "rdma_ucm" to "rdma_cm" (same bug).
  * 40-permissions.rules, 40-basic-permissions.rules:
    - Split out the most basic permissions into a separate file that can be
      used in the installer and initramfs. LP: #204108.
    - Add rules to place known USB serial devices that need libusb access
      in the dialout group. LP: #198757.
  * 65-persistent-storage.rules, 65-persistent-storage-tape.rules,
    65-persistent-input.rules, 66-persistent-storage-edd.rules:
    - Use upstream rule names for all rules. Also LP: #186686.
    - Add persistent-storage-edd.rules to installer and initramfs.
  * 80-programs.rules:
    - Pass $root/%k to create-floppy-devices, not $tempnode. LP: #132546.

 -- Scott James Remnant <email address hidden> Wed, 02 Apr 2008 18:59:56 +0100

Changed in udev:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.