import serial
ser = serial.Serial('/dev/ttyS0',115200)
ser.flush()
while True:
    flo = ord(ser.read())
    fhi = ord(ser.read())
    flash_page = flo + 256 * fhi
    blo = ord(ser.read())
    bhi = ord(ser.read())
    buffer_count = blo + 256 * bhi
    spi_byte = ord(ser.read())

    print "page", flash_page, "byte", buffer_count, "content", spi_byte,
    print "(",flo, fhi, blo, bhi, spi_byte,")"
