Turtlebot needs /dev/kobuki

Bug #1645445 reported by Michael Benz
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
snapd
Triaged
Low
Samuele Pedroni

Bug Description

When you install ROS and the Turtlebot specific packages it install a udev rule to create /dev/kobuki which is an alias to whichever USB device it is mapped to when attached (usually /dev/ttyUSB0). We need an interface to install and execute the udev rule or creating the alias would work as well.

udev rules file installed for kobuki does the following:

# On precise, for some reason, USER and GROUP are getting ignored.
# So setting mode = 0666 for now.
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="kobuki*", MODE:="0666", GROUP:="dialout", SYMLINK+="kobuki"
# Bluetooth module (currently not supported and may have problems)
# SUBSYSTEM=="tty", ATTRS{address}=="00:00:00:41:48:22", MODE:="0666", GROUP:="dialout", SYMLINK+="kobuki"

Revision history for this message
Michael Benz (michael-j-benz) wrote :
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for filing a bug.

The fact that this is a symlink to /dev/ttyUSB0 suggests this should be part of the serial-port interface in some way. The serial-port interface can create symlink udev rules from product and vendor ids specified by the gadget snap slot. Eg, if the gadget snap for the ROS device had this:

name: my-gadget
slots:
  kobuki-device:
    interface: serial-port
    path: /dev/kobuki
    usb-vendor: 0x0403
    usb-product: 0x6001

Then the following rule would be created (assuming serialUdevSymlinkPattern has adjusted to handle this):
SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0x0403", ATTRS{idProduct}=="0x6001", SYMLINK+="kobuki"

and plugging snaps simply:

name: my-snap
plugs:
  kobuki:
    interface: serial-port

then you manually connect with:
$ sudo my-snap:kobuki my-gadget:kobuki-device

which allows my-snap access to the device with usb-vendor 0x0403 and usb-product 0x6001 (snapd does this via device cgroup) and it can be accessed via /dev/kobuki.

@Michael, is the udev rule that I posted above sufficient for your needs? Based on /lib/udev/rules.d/50-udev-default.rules it looks like serial devices get GROUP:="dialout" already. I think all that remains is ATTRS{serial}=="kobuki*" and MODE:="0666"; local testing shows that it may get 0660 by default. This won't affect daemons on snappy since those run as root, but it will mean that regular users need to use sudo unless they are added to the dialout group (and I think this is the correct approach btw-- snappy can make group membership handling for the default user easier in the future).

Changed in snappy:
status: New → Incomplete
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

@Jamie,

I do think such an addition would be useful, but that's only a solution for Ubuntu Core, not classic (as classic obviously doesn't have a gadget). Ideally we'd have a solution for classic, since that's where the snap is usually built and tested.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

To be clear, ideally we'd have a solution that worked on both Ubuntu Core _and_ classic, not just one or the other.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

@Kyle, core is intended to be able to dynamically discover things like serial ports, etc and expose them automatically as slots. Gustavo is designing this along with hotplugging AIUI. What is described is what we have today for dealing with this, but once there is an implementation for core, then it should be possible to extend that to classic.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

> @Kyle, core is intended to be able to dynamically discover things like serial ports, etc and expose them automatically as slots. Gustavo is designing this along with hotplugging AIUI.

Indeed, that's my understanding as well.

> What is described is what we have today for dealing with this, but once there is an implementation for core, then it should be possible to extend that to classic.

Fair enough, what you describe does sound like it'll solve this issue for core.

Revision history for this message
Michael Benz (michael-j-benz) wrote :

@Jamie, yes I suppose the proposed entries for the gadget would work it will just require anyone that wants to use it in one of our official images will have to modify and rebuild the gadget and image but that will have to be done to enable the serial-port interface anyway correct?

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

@Michael, yes that would have to be with serial-port too. Note my comment to Kyle-- this being a gadget-only mechanism is temporary until the design is finalized and implemented, which AIUI is a high priority for the snappy team.

Kyle Fazzari (kyrofa)
Changed in snappy:
status: Incomplete → Confirmed
Kyle Fazzari (kyrofa)
affects: snappy → snapd
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Those interested in this and similar bugs, please see:

https://forum.snapcraft.io/t/what-priority-of-hotplug-support-getting/345

Changed in snapd:
importance: Undecided → High
status: Confirmed → Triaged
Changed in snapd:
assignee: nobody → Samuele Pedroni (pedronis)
Revision history for this message
Samuele Pedroni (pedronis) wrote :

hotplug now exists as an experimental feature:

https://forum.snapcraft.io/t/hotplug-support/10750

Revision history for this message
Ian Johnson (anonymouse67) wrote :

As far as I can tell, with hotplug now available for the serial-port interface, all that's needed is to expand the allowed regex to allow kobuki as a serial port pattern, correct?

Changed in snapd:
importance: High → Medium
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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