Skip to content

Commit

Permalink
Merge pull request #34 from shing19m/master
Browse files Browse the repository at this point in the history
Add option to query the chip id of the used module.
  • Loading branch information
4refr0nt committed Nov 1, 2015
2 parents 6bb3754 + 4565ce1 commit d10fb7e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions luatool/luatool.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def openserial(args):
parser.add_argument('-a', '--append', action='store_true', help='Append source file to destination file.')
parser.add_argument('-l', '--list', action='store_true', help='List files on device')
parser.add_argument('-w', '--wipe', action='store_true', help='Delete all lua/lc files on device.')
parser.add_argument('-i', '--id', action='store_true', help='Query the modules chip id.')
parser.add_argument('--delete', default=None, help='Delete a lua/lc file from device.')
args = parser.parse_args()

Expand All @@ -113,6 +114,19 @@ def openserial(args):
sys.stdout.write(char)
sys.exit(0)

if args.id:
s = openserial(args)
writeln("=node.chipid()\r", 0)
id=""
while True:
char = s.read(1)
if char == '' or char == chr(62):
break
if char.isdigit():
id += char
print("\n"+id)
sys.exit(0)

if args.wipe:
s = openserial(args)
writeln("local l = file.list();for k,v in pairs(l) do print(k)end\r", 0)
Expand Down

0 comments on commit d10fb7e

Please sign in to comment.