def perform_fwinfo(dev, args): recipient = get_device_pid(args.device_type) info = fwinfo(dev, recipient) if info: print(info) else: print('FW info request failed')
def perform_dfu(dev, args): dfu_image = args.dfu_image recipient = get_device_pid(args.device_type) img_ver_file = get_dfu_image_version(dfu_image) if img_ver_file is None: print('Cannot read image version from file') return info = fwinfo(dev, recipient) if info is None: print('Cannot get FW info from device') return img_ver_dev = info.get_fw_version() print('Current FW version from device: ' + '.'.join([str(i) for i in img_ver_dev])) print('Current FW version from file: ' + '.'.join([str(i) for i in img_ver_file])) print('Perform update? [y/n]') if not args.autoconfirm: rsp = input().lower() if rsp == 'y': pass elif rsp == 'n': print('DFU rejected by user') return else: print('Improper user input. Operation terminated.') return success = dfu_transfer(dev, recipient, dfu_image, progress_bar) if success: success = fwreboot(dev, recipient) if success: print('DFU transfer completed') else: print('DFU transfer failed')
def perform_fwinfo(self): return fwinfo(self.dev, self.pid)