Skip to content

Commit

Permalink
Merge pull request #28 from comawill/pull-req/fix26
Browse files Browse the repository at this point in the history
Attempt to solve Issue #26 (Motes change names while programming)
  • Loading branch information
Enrico Jorns committed Nov 11, 2014
2 parents 3eb77b5 + c51ffe7 commit 94259a1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
9 changes: 9 additions & 0 deletions platform/inga/99-inga-usb.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# example udev-rule
# change groupname if needed
#
# create symlink at /dev/inga/node-${SERIALID}
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{product}=="INGA", SYMLINK+="inga/node-$attr{serial}"
# assign to group plugdev
KERNEL=="ttyUSB[0‐9]*", GROUP="plugdev"
# assign to group plugdev
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="plugdev"
12 changes: 4 additions & 8 deletions platform/inga/Makefile.inga
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,14 @@ UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
# Mac OS X
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-macos
MOTELIST ?= $(CONTIKI)/tools/sky/motelist-macos
MOTES ?= $(shell $(MOTELIST) 2>&- | grep usbserial | \
cut -f 4 -d \ | \
perl -ne 'print $$1 . " " if(m-(/dev/\w+\.\w+\-\w+)-);')
MOTELIST ?= $(CONTIKI)/tools/inga/motelist
MOTES ?= $(shell $(MOTELIST))
else ifeq ($(UNAME), Linux)
# Linux
INGA_TOOL = $(CONTIKI)/tools/inga/inga_tool/inga_tool
SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux
MOTELIST ?= $(CONTIKI)/tools/sky/motelist-linux
MOTES ?= $(shell $(MOTELIST) 2>&- | grep USB | \
cut -f 4 -d \ | \
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
MOTELIST ?= $(CONTIKI)/tools/inga/motelist
MOTES ?= $(shell $(MOTELIST))
else
$(warning Operating system '$(UNAME)' not supported)
endif
Expand Down
30 changes: 30 additions & 0 deletions tools/inga/motelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
import glob
import platform

# Simple script that collects all available INGA-motes
#
# On Linux-systems with udev-rule $(CONTIKI)/platform/inga/99-inga-usb.rule
# it is also possible to fetch only INGA-motes

if __name__ == "__main__":
motes = []
system = platform.system()

if(system == "Darwin"): # OS X
motes = glob.glob("/dev/tty.usbserial-*")

elif(system == "Linux"): # Linux
motes = glob.glob("/dev/inga/*")

if not motes:
motes = glob.glob("/dev/serial/by-id/*IBR_INGA*")

if not motes:
motes = glob.glob("/dev/ttyUSB*")

if motes:
for mote in motes:
print(mote)
exit(0)
exit(1)

0 comments on commit 94259a1

Please sign in to comment.