Hi Liao,

I am replying on-list as I suspect this information may help other people
as well. For those googling, these are instructions for how to write a udev
rule so that serial programmers for TinyOS motes do not require root access.

I am not too familiar with the exact programmer you are using so I will
give some generic instructions for how you would construct a udev rule for
any programmer. The first thing to do is to plug it in and determine the
vendor id and product id. Often the easiest way to do this is read the tail
of dmesg, as most devices will spew some stuff out there:

$ sudo dmesg | tail

[509378.443148] usb 2-1.5: new full-speed USB device number 12 using
ehci-pci
[509378.541889] usb 2-1.5: New USB device found, idVendor=0403,
idProduct=6001
[509378.541896] usb 2-1.5: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[509378.541900] usb 2-1.5: Product: FT232R USB UART
[509378.541904] usb 2-1.5: Manufacturer: FTDI
[509378.541907] usb 2-1.5: SerialNumber: A4004b42
[509379.030999] usb 2-1.5: reset full-speed USB device number 12 using
ehci-pci
[509379.210922] usb 2-1.5: reset full-speed USB device number 12 using
ehci-pci

Sometimes your programmer will not show up there, but you can find it using
lsusb:

$ sudo lsusb
...
Bus 002 Device 012: ID 0403:6001 Future Technology Devices International,
Ltd FT232 USB-Serial (UART) IC
...

Both of these methods are telling me that my vendor ID is 0403, and my
product ID is 6001. Now I can generate my udev rules file in
/etc/udev/rules.d. I called this one 99-ftdi.rules. In here you need to put
the following:

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"

Where you will change the IDs to match your programmer. You will note that
the syntax is different from what you used. To apply the rule to your
device you can either unplug and re-plug it in or theoretically you can run:

$ sudo udevadm trigger

>From here, you should be able to use your device without being root.

Regards
Michael


On 2 April 2014 14:35, Liao Qingbi <[email protected]> wrote:

> Hi,
>
> I'm Qingbi. I'm really sorry to bother you. I send this email to see if
> you could tell me more about setting up the udev rules? I have created a
> new file under the path* etc/udev/rules.d *and name it as
> *99-ttyUSB.rules.* In this file, I write *SUBSYSTEM=="tty",
> GROUP="dialout". MODE="0660"*
> After that, I ran two commands below to make it have the usual permission.
>
> $     sudo chown root:root /etc/udev/rules.d/99-*ttyUSB*.rules
> $     sudo chmod 0644 /etc/udev/rules.d/99-*ttyUSB*.rules
>
> But still I have to use  *$ chmod 777 /dev/ttyUSB0 to *give the USB
> permission every time.  Would you please tell me how you do this or Is
> these something wrong with my steps?
> Thanks for your reading and may you have a nice day.
>
> Best regards
> Qingbi Liao
>
> On Mar 31, 2014, at 6:28 PM, Michael Andersen <[email protected]>
> wrote:
>
> Hi
>
> This is due to a lack of permissions on the USB serial device. The quick
> hack is to program as root, the correct solution is to set up your udev
> rules so that the permissions on the ttyUSB device allow writing by
> unprivileged users.
>
> Regards
> Michael
>
>
> On 31 March 2014 09:24, Liao Qingbi <[email protected]> wrote:
>
>> Hi, everybody
>>
>> I'm new to TinyOS and trying to write the simple Blink application into
>> sensor mib510.  But I didn't succeed yet since there is always an error:
>> Permission denied.
>> I have already tried the command:
>> $ sudo chown qingbi:qingbi -R /opt/tinyos-2.1.2/
>> And it still doesn't work.
>> By the way, the *make micaz sim* part could work well in my PC.
>> The running result is attached below, hoping someone could help me out.
>> Thank you so much.
>>
>> qingbi@qingbi-VirtualBox:~$ cd tinyos-2.1.2/apps/Blink/
>> qingbi@qingbi-VirtualBox:~/tinyos-2.1.2/apps/Blink$ make micaz install
>> mib510,/dev/ttyUSB0
>> mkdir -p build/micaz
>>     compiling BlinkAppC to a micaz binary
>> ncc -o build/micaz/main.exe  -Os -fnesc-separator=__ -Wall -Wshadow
>> -Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=micasb
>> -DDEFINED_TOS_AM_GROUP=0x22 --param max-inline-insns-single=100000
>> -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"qingbi\"
>> -DIDENT_HOSTNAME=\"qingbi-VirtualB\" -DIDENT_USERHASH=0xdca414e2L
>> -DIDENT_TIMESTAMP=0x53399425L -DIDENT_UIDHASH=0x1fc3b583L
>> -fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())'
>> -fnesc-dump='referenced(interfacedefs, components)'
>> -fnesc-dumpfile=build/micaz/wiring-check.xml BlinkAppC.nc -lm
>>     compiled BlinkAppC to build/micaz/main.exe
>>             2044 bytes in ROM
>>               51 bytes in RAM
>> avr-objcopy --output-target=srec build/micaz/main.exe
>> build/micaz/main.srec
>> avr-objcopy --output-target=ihex build/micaz/main.exe
>> build/micaz/main.ihex
>>     writing TOS image
>> cp build/micaz/main.srec build/micaz/main.srec.out
>>     installing micaz binary using mib510
>> uisp -dprog=mib510 -dserial=/dev/ttyUSB0 --wr_fuse_h=0xd9
>> -dpart=ATmega128  --wr_fuse_e=ff   --erase --upload
>> if=build/micaz/main.srec.out --verify
>> Error: Permission denied
>>  -> /dev/ttyUSB0
>> make: *** [program] Error 1
>>
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to