I am using AVRDUDE for Android (http://code.google.com/p/andavr/). I can compile the C code. I can run

$ avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o led.o led.c $ avr-gcc -mmcu=atmega328p led.o -o led $ avr-objcopy -O ihex -R .eeprom led led.hex

all without issues. Then I try to run:

avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/002 -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex

The result is:

avrdude: ser_open(): can't open device "/dev/bus/usb/002/002"; Permission denied loctl("TIOCMGET"): Invalid argument avrdude done. Thank you.

The situation is similar when I run:

avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/001 -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex

I can confirm that /dev/bus/usb/002/002 is the Arduino device connected with the OTG cable. Before connecting, I run

ls -l /dev/bus/usb/002/

and I get:

total 0

After I connect the Arduino via USB to my tablet I run the command:

ls -l /dev/bus/usb/002

and I get

crw-rw---- 1 0 1018 180,128 Mar 24 07:53 001 crw-rw---- 1 0 1018 180,129 Mar 24 07:53 002

This clearly shows me that the Arduino is connected. I would love to know if anyone can see what I am doing wrong.

PS: I am trying to create an Android application that allows Arduino programming directly from an Android tablet.