applet.interface.spi_flashrom: Allow empty reads
by
Matt Johnston
3 weeks 4 days
applet.interface.spi_flashrom: Allow empty reads
Running flashrom with --layout can result in zero length reads, which
would otherwise hit an assertion. Just return an empty buffer.
flashrom -p serprog:ip=localhost:7788 -c MT25QU01G --read dump1.bin --layout /path/to/file.layout --include part3
| Traceback (most recent call last):
| File "glasgow/software/glasgow/cli.py", line 797, in applet_task
| await applet.run(applet_parsed_args)
| File "glasgow/software/glasgow/applet/bridge/spi_flashrom/__init__.py", line 158, in run
| await SerprogCommandHandler(self.logger, self.spi_iface, endpoint).handle_cmd()
| File "glasgow/software/glasgow/applet/bridge/spi_flashrom/__init__.py", line 91, in handle_cmd
| rdata = await self.spi_iface.read(rlen)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "glasgow/software/glasgow/applet/interface/spi_controller/__init__.py", line 215, in read
| octets = await self._pipe.recv(count)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "glasgow/software/glasgow/hardware/assembly.py", line 175, in recv
| assert length > 0
| ^^^^^^^^^^
| AssertionError