Example #1
0
 def get(self):
     ports = get_serial_ports()
     data = []
     for port, desc in ports:
         if port == '/dev/ttyAMA0':
             # ignore RPi built-in serial port
             continue
         data.append({'port': port, 'desc': desc})
     data.append({'port': 'OTA', 'desc': 'Over-The-Air Upload/Logs'})
     self.write(json.dumps(data))
Example #2
0
 def get(self):
     if not self.is_authenticated():
         self.redirect('/login')
         return
     ports = get_serial_ports()
     data = []
     for port, desc in ports:
         if port == '/dev/ttyAMA0':
             desc = 'UART pins on GPIO header'
         split_desc = desc.split(' - ')
         if len(split_desc) == 2 and split_desc[0] == split_desc[1]:
             # Some serial ports repeat their values
             desc = split_desc[0]
         data.append({'port': port, 'desc': desc})
     data.append({'port': 'OTA', 'desc': 'Over-The-Air'})
     self.write(json.dumps(sorted(data, reverse=True)))