pslab flash <hexfile> fails before it can talk to the bootloader. The refactor in e70d01d ("Refactor SerialHandler") moved ScienceLab to wrap a connection handler (ScienceLab(device), psl.device) and dropped the interface attribute. The flashing code still uses the old API:
cli.main calls pslab.ScienceLab(args.port), passing the port string as the device:
AttributeError: 'str' object has no attribute 'get_firmware_version'. With no -p, it autoconnects a second time, although main has already opened the port with SerialHandler.
cli.flash reads psl.interface.baudrate:
AttributeError: 'ScienceLab' object has no attribute 'interface'
ScienceLab.enter_bootloader sets self.device.interface.baudrate:
AttributeError: 'SerialHandler' object has no attribute 'interface'
flash also passes the ScienceLab itself to mcbootflash, which needs an object with read/write (psl.device has them; ScienceLab doesn't).
Reproduced with a SerialHandler on pyserial's loop:// port:
h = SerialHandler("loop://"); h._ser = serial.serial_for_url("loop://", baudrate=1000000)
psl = ScienceLab.__new__(ScienceLab); psl.device = h
cli.flash(psl, "fw.hex") # AttributeError: 'ScienceLab' object has no attribute 'interface'
psl.enter_bootloader() # AttributeError: 'SerialHandler' object has no attribute 'interface'
ScienceLab.read_log has the same leftover (self.device.interface.readline(), self.get_ack()). I haven't included it here, since it's not on the flashing path.
pslab flash <hexfile>fails before it can talk to the bootloader. The refactor in e70d01d ("Refactor SerialHandler") movedScienceLabto wrap a connection handler (ScienceLab(device),psl.device) and dropped theinterfaceattribute. The flashing code still uses the old API:cli.maincallspslab.ScienceLab(args.port), passing the port string as the device:AttributeError: 'str' object has no attribute 'get_firmware_version'. With no-p, it autoconnects a second time, althoughmainhas already opened the port withSerialHandler.cli.flashreadspsl.interface.baudrate:AttributeError: 'ScienceLab' object has no attribute 'interface'ScienceLab.enter_bootloadersetsself.device.interface.baudrate:AttributeError: 'SerialHandler' object has no attribute 'interface'flashalso passes theScienceLabitself tomcbootflash, which needs an object withread/write(psl.devicehas them;ScienceLabdoesn't).Reproduced with a
SerialHandleron pyserial'sloop://port:ScienceLab.read_loghas the same leftover (self.device.interface.readline(),self.get_ack()). I haven't included it here, since it's not on the flashing path.