Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can´t upload code to Arduino Uno using stino and Ubuntu 12.04 (Precise Pangolin)

I have installed stino on Sublime Text 2 succesfully, but when I try to upload my code to Arduino Uno, the output is the following:

Uploading /home/lucas/Arduino_Build/programa_teste/programa_teste.hex to Arduino Uno...
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
[Stino - Error while uploading.]

I have the Arduino IDE installed, and it is working fine, only Sublime Text can´t upload the code.

like image 892
Lucas Simonini Avatar asked Oct 04 '22 22:10

Lucas Simonini


1 Answers

well, as @Bibhas says, your problem is that /dev/ttyACM0 is having the wrong permissions, and that has nothing to do with Arduino or sublime text. It's the linux kernel who creates character devices per default with no user permissions.

But good thing is that it can be changed!

The fast and easy solution is to add your current user to the dialout group:

sudo adduser YOU dialout

where YOU is your username and then log out and log back in to have those new permissions propagated into your shells.

Hint:

There's a solution that is a bit more complicated, is to create a udev rule such as:

/etc/udev/rules.d/48-arduino.rules

SUBSYSTEM!="usb_device", ACTION!="add", GOTO="arduino_end"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", MODE="660", GROUP="arduino", SYMLINK+="arduino.leonardo"
LABEL="arduino_end"

which creates a /dev/arduino device readable and writable by the arduino group, that you need to create (or you can use the default dialout group which is perfectly fine):

addgroup arduino
adduser YOU arduino

and then reload your rules:

sudo udevadm control --reload-rules

The nice thing about that second hint is that when you unplug replug your arduino, you won't have it change device number oddly, it will be kept to the name. If you're not using an arduino leonardo, you can check your device idvendor/idproduct using lsusb:

% lsusb                
…                      ↓↓↓↓ ↓↓↓↓
Bus 006 Device 105: ID 2341:0036 Arduino SA 
…

HTH

like image 197
zmo Avatar answered Oct 13 '22 11:10

zmo