Skip to content

Make it work with Python 3 and BusPirate#1

Open
lkundrak wants to merge 5 commits intoklirichek:masterfrom
hackerspace:BusPirate
Open

Make it work with Python 3 and BusPirate#1
lkundrak wants to merge 5 commits intoklirichek:masterfrom
hackerspace:BusPirate

Conversation

@lkundrak
Copy link

@lkundrak lkundrak commented Jul 3, 2023

This made the tool so much more useful to me that I had to tell all my friends and some enemies too.

lkundrak added 5 commits July 3, 2023 23:05
This is wrong. Perhaps Python 2 was a little more forgiving so this
didn't cause an exception.
Not as good as Perl, but generally more available than Python 2
nowadays.
This 512K chip is on a Book8088's LCD driver board.
Let's parse the option first, before accessing the I2C bus. This will
allow us to choose between different I2C backends.

Besides that, there's absolutely no need to catch GetoptError exceptions
for anything other than call to getopt().
Add support for programming via BusPirate using the pyBusPirateLite
library.

The backend is negotiated automatically, BusPirate silently fallen back
to if the smbus backend doesn't work.

The --backend option allows explicitly choosing the backend, which is
useful for getting a traceback in case of a failure instead of the
silent fallback.

  $ time python pyprog.py -w sad-and-broken.bin
  Can't use SMBUS backend (use --backend=smbus to force it anyway), attempting BusPirate...
  Using BusPirate backend (assuming --backend=buspirate)
  JEDEC ID: 0x856013
  Manufacturer PUYA
  Chip: P25Q40
  Size: 512KB
  Setup chip commands for Winbond...
  Flash status register: 0x0
  Erasing...
  done
  Flashing sad-and-broken.bin
  Will write 512Kb
  Writting addr 6800
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant