Author Topic: Is there a way to program chip using arduino IDE without having to be root?  (Read 2712 times)

0 Members and 1 Guest are viewing this topic.

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2257
  • Country: ca
I am using the arduino IDE to program a chip using an USBTinyISP but it refuses to work unless you're root.  This causes all sorts of permission issues because the folder all my files are in have different permissions than the sketch and because of Linux's limited permission system it's not as simple as just adding two users to both have permissions to the folder.     You'd think root would just have access to everything, but NFS does weird stuff.  All my data is stored on NFS, not locally.

So long story short, is there a way to set it up so I can program using the actual user that I login with?  I always end up having to execute the IDE as root so that it lets me program.

OS is Linux Mint 17.1.

As a side note, what commands does the arduino IDE invoke to program, is there a way to find out?  I imagine it depends on the chip and such.  It would be easier if I can just make a script to run that.  Optionally I could just have that script run as root but still edit the file as my regular user.
« Last Edit: July 11, 2016, 05:49:52 am by Red Squirrel »
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2392
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Online blueskull

  • Supporter
  • ****
  • Posts: 12343
  • Country: cn
  • Power Electronics Guy
Yep, udev.
 

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2257
  • Country: ca
Which of those lines is suppose to work for mint 17.1?  I tried all 3 but still get the error. Does it matter what I name the file, or what the extension is?  Does it require a reboot or anything like that? (hopefully not I have too much stuff open)

Edit: Also I think I recall reading somewhere that my user has to be in the "dialout" group. I had previously did that so I am in that group.   I'm trying the last line in that tutorial as I figure Mint 17.1 probably counts as "recent ubuntu".   I also found a command "udevadm control --reload-rules" that has to be run after making changes. So I tried that as well.

Edit2: So I bit the bullet and rebooted.  Still not working.  Anything else I can try?
« Last Edit: July 11, 2016, 06:21:54 am by Red Squirrel »
 

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2257
  • Country: ca
Got it!

Turns out I have to name the file with the .rules extension.   
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2392
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
As a side note, what commands does the arduino IDE invoke to program, is there a way to find out?

File > Preferences > Show verbose output during: compilation, upload

Commands executed are placed in the console output area.

~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: oPossum

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2257
  • Country: ca
Thanks!  That's great to know.  I eventually want to just script this so it's easier.   i eventually want to learn to code the chips without relying on arduino, but baby steps. :P  Just so much easier to find info online by searching "[what I want to do] arduino".
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9097
  • Country: my
  • reassessing directives...
As a side note, what commands does the arduino IDE invoke to program, is there a way to find out?  I imagine it depends on the chip and such.  It would be easier if I can just make a script to run that.  Optionally I could just have that script run as root but still edit the file as my regular user.
if its the same as windows, and it should be. Arduino ide will invoke avrdude.exe with arguments like board/chip type (selected from menu),port number,temp file path to hex output and such.. which in turn the avrdude will program the board through the comm channel,usb or what..to see how exactly the argument looks like, you can build dummy middleman avrdude and temporarily replace the original avrdude,otherwise look out for help file that i'm not sure where. fwiw..
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2392
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
you can build dummy middleman avrdude and temporarily replace the original avrdude,

Or, as I wrote above, turn on verbose output, then you see what commands get run, with all their arguments.  No middleman required.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: Kilrah

Offline technix

  • Super Contributor
  • ***
  • Posts: 3216
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Code: [Select]
sudo addgroup --system usb
echo SUBSYSTEMS==\"usb\", GROUP=\"usb\", MODE=\"664\" | sudo tee -a /etc/udev/rules.d/00-usb.rules
for each in usb tty dialout; do sudo usermod -aG $each $(whoami); done
sudo reboot

Create a new system group called "usb", add yourself into it (as well as groups "tty" and "dialout" so you can access serial ports too,) add a udev rule to make all USB devices owned by the "usb" group, and finally reboot to make it all work.
 

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2257
  • Country: ca
Ohhh I like that one better, so it will work for everything USB and not just that specific one?  I'll have to try that out.
 

Offline Mr J

  • Regular Contributor
  • *
  • Posts: 93
    • Facebook mjssvt
I just ran into this myself with Ubuntu 14 not sure about mint, there are a couple of ways depending on version

http://mightyohm.com/blog/tutorials/avr-toolchain-installation/linux/ for (version 10 and lower)

http://feedback.codebender.cc/knowledgebase/articles/387072-how-to-use-usbtinyisp-programmer-in-linux (Version 12 and 14 and 16)

Mr J, N1IR
 

Offline Mr J

  • Regular Contributor
  • *
  • Posts: 93
    • Facebook mjssvt
yea ever since Arduino 1.0 you need to change permission to access the USB
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf