+def op_sync(s, img_num):
+ sreqpkt = SerialReqPacket((MSG_SYNC, img_num, 0, 0, []))
+ success = s.write_packet(SERIAL_AMGROUP, SERIAL_AMID, sreqpkt.payload())
+ if success == True:
+ packet = s.read_packet(SERIAL_AMGROUP, SERIAL_AMID)
+ sreplypkt = SerialReplyPacket(packet[1])
+ if sreplypkt.error == ERROR_SUCCESS:
+ return True
+ else:
+ print "ERROR: Unable to sync the flash volume"
+ return False
+
+ print "ERROR: Unable to send the command"
+ return False
+