Can someone help me with python? The problem for me is that the tool tos-bsl is written in python, which is one I cannot use, but I need to add a change in a script. The tool accepts comport as number in win/cygwin, starting from 0 which is COM1. I wish to avoid using numbers and instead use comport name. I.e. to start tos-bsl win option "-c COM17" instead of using "-c 16". This will allow me to focus on coding, and will remove the overhead of debugging motes that are incidentally programmed with different code. I read through source of tos-bsl.in file . The interesting part is between lines 1357 to 1359, where the option is accepted:
Elif o in ("-c", "--comport"): Try: ComPort = int(a) #try to convert decimal Except ValueError: ComPort = a #take the string and let serial driver decide So if a string is used it is directly assigned to ComPort and later is used, which works on Linux, but if it is COMx cannot be used. I wish to add a check before assignment something like this: Elif o in ("-c", "--comport"): Try: ComPort = int(a) #try to convert decimal Except ValueError: if a[0:2] == "COM": #check for leading COM" word ComPort = int(a[3:],10) - 1 #calculate the base, like if it is given from command line Else: #or continue as up to now ComPort = a #take the string and let serial driver decide So I have two problems 1. I don't know if the code which I add is correct - link to any help/tutorial about python is appreciated. 2. I don't know how to produce tos-bsl.exe and put it in /usr/bin. Thank you in advance. Hristo Bojkov Platform: WinXp/Cygwin TinyOS: 2.0.2 Device: Tmote _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help