#!/usr/bin/python

import serial, string

output = " "
ser = serial.Serial('/dev/ttyUSB1', 9600, 8, 'N', 1, timeout=1)
while True:
  while output != "":
    output = ser.read(4)
    print len(output)
    try:
        print int(output)
    except ValueError:
        print ":".join("{:02x}".format(ord(c)) for c in output)
        print output
  output = " "