Menu

#1155 pduino doesn't work unless pd-extended run with sudo

v0.43
pending-works-for-me
nobody
5
2014-09-22
2014-09-15
sistisette
No

0.43-4 extended Ubuntu 14.04

Run Pd Extended and create a [pduino/arduino]

Send it the "devices" message.

Expected: should list available devices
Observed: says "[comport]: available serial ports:"
and systematically an empty list.

Now send it the "open 32" message, where 32 is a valid port where's there is a working arduino connected with the StandardFirmata firmware running.

Expected: should connect.
Observed: issues an error like "could not open serial port: access denied" (didn't copy it, just by memory).

Now run Pd Extended with sudo: => everything works as expected.

Root privileges shouldn't be needed for using an arduino. There almost surely is a way to avoid this, and if there is not, then it should ask you to enter your sudo password through a GUI like all other program do when they need sudo privileges.

Also, I had used pd extended and pduino ages ago on Ubuntu and I hadn't experienced this problem, so it is almost certainly a regression.

Discussion

  • IOhannes m zmölnig

    it seems you do not have permissions to access the serial ports.

    assuming that you are using a serial-over-USB device, what does the following give you:

    $ ls -l /dev/ttyUSB*
    

    check the group of the device (most likely it is something like dialout), and add your user to that group

    $ sudo adduser ${USER} dialout
    

    after logging out and in again, you should be able to use the device.

    note: you should not make the device read/writeable for everybody, nor should you attempt to run Pd as root

     
  • IOhannes m zmölnig

    • labels: --> comport, permissions
    • status: open --> pending-works-for-me
     
  • Anonymous

    Anonymous - 2014-09-21

    I see. Done.

    Is the main user of a default Ubuntu installation expected to normally belong to that group? If it is, then I'll report the issue to Ubuntu.
    If it is not, then the Ubuntu package pd-extended should by default add the user to the group when installed (perhaps after warning or asking whether to do that).

    Or perhaps [arduino] may include a message (or extend the "devices" message) to list devices including those that cannot be accessed (if ls can do that, pduino can do that) and the group they belong to, so as to provide enough debugging information.

    In a way or another, I'd expect a fresh installation of Pd Extended, which includes pduino, to be capable of connecting to available arduinos out of the box, or at least detect them and help you figure out what's wrong with them, if anything is.

    I had used older versions of Pd Extended on older version of Ubuntu and I don't remember hitting this problem before (but it is possible that I did, "fixed" it and forgot)

     
  • IOhannes m zmölnig

    i don't think that an end-user package 8ardlike Pd-extended should fuddle with your user/group settings at all, as this can mean severe security implications on your system.
    the pkg-installation is running as root and has no way to know who "your" user is (there is no concept of a "main user" on un*x).

    whether the system (e.g. ubuntu) should automatically add non-system (that is: "normal") users to the relevant group, should be decided by the ubuntu folks (so yes, go ahead and report the issue; the worst that can happen is that they reject it).

    as for listing non-accessible devices: that's a bit tricky, as [comport] (that's the object handling the serial port connection within [arduino]) has no way of knowing, whether a given device-file is actually usable if it cannot access it. you need (at least) read permissions in order to detect the devices, so this is a chicken-egg problem.

    as for "help you figure out what's wrong with them", i think that the error message was very clear:

    access denied

    ... means that you do not have permissions to use the given device.

    i think what needs to be changed on the [arduino] side is the documentation: the help-patch for the object (and for ´[compor]` as well) should mention that you need the proper permissions in order to use specific hardware.

     
  • sistisette

    sistisette - 2014-09-22

    as for "help you figure out what's wrong with them", i think that the error message was very clear:
    access denied

    That was only because I tried with a random "open 32" because I remembered that on another computer I had used Arduino and the port was 32. But otherwise, I could never have guessed the port number. The message is clear when you already know what the port is and try to access it.
    But when you send the "devices" message and get an empty list, you don't have the slightest clue.

    i don't think that an end-user package 8ardlike Pd-extended should fuddle with your user/group settings at all,

    It could ask

    the pkg-installation is running as root and has no way to know who "your" user is (there is no concept of a "main user" on un*x).

    I suspected that. It could prompt you to enter your username.

    as for listing non-accessible devices: (...) this is a chicken-egg problem.

    We were able to solve the problem from a terminal with "ls -l /dev/ttyUSB*", without ever using sudo, right? So it's not a full chicken-egg problem.
    It may be a problem to distinguish significant from non-significant results, though.
    If there's a guarantee (or almost) that an Arduino device file path always starts with /dev/ttyUSB, then [arduino] could do the equivalent of a "ls -l" and parse the results (this should be done at the [arduino] level, I guess, not at the [comport] level which may want to deal with other kind of devices). I mean with a message other than "devices" or with "devices someparameter".
    I guess this won't be able to give you the port numbers, but if I remember correctly one can use a message like "open /dev/ttyUSBxxxx".

    i think what needs to be changed on the [arduino] side is the documentation: the help-patch for the object (and for ´[compor]` as well) should mention that you need the proper permissions in order to use specific hardware.

    Well yes, that would be the bare minimum. Such a warning could also be added to the output of "devices".

     

    Last edit: sistisette 2014-09-22

Anonymous
Anonymous

Add attachments
Cancel