diff --git a/CHANGELOG b/CHANGELOG index a12610b..c2a6ee7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +2024-05-23: do not install system files when building/installing as user (#27) [9664f5f] 2024-05-23: new tool upload_firmware_6022.py (upload to different VID:PID) [c85792d] 2024-05-06: make scopevis.py example program really useful [ea05828] 2024-05-03: upversion 2.10.8; update examples and doc [ac44d00] diff --git a/README.md b/README.md index 4a6401b..40323f9 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,10 @@ This means: - download this repo (as `https://github.com/Ho-Ro/Hantek6022API/archive/refs/heads/main.zip`) - or execute `git clone https://github.com/Ho-Ro/Hantek6022API.git` +- to enable user access to the device copy (as root) the file `udev/60-hantek6022api.rules` +into `/etc/udev/rules.d` - go to `examples` -- try e.g. `python3 get_serial_number.py`. - +- try e.g. `python3 get_serial_number.py` ## Developer Info diff --git a/examples/README.md b/examples/README.md index 530b354..3315232 100644 --- a/examples/README.md +++ b/examples/README.md @@ -91,9 +91,9 @@ usage: upload_6022_firmware_from_hex.py HEXFILE Uploads firmware from intel hex file to device ### `upload_6022_firmware.py` -Uploads standard firmware to device - deprecated, will be replaced by ´upload_firmware_6022.py´ +Uploads standard firmware to device - deprecated, will be replaced by `upload_firmware_6022.py` -### ´upload_firmware_6022.py´ +### `upload_firmware_6022.py` ``` usage: upload_firmware_6022.py [-h] [-V VID] [-P PID] [--be | --bl] @@ -101,12 +101,28 @@ Upload firmware to Hantek6022 devices with different VID:PID options: -h, --help show this help message and exit - -V VID, --VID VID - -P PID, --PID PID - --be, --6022be - --bl, --6022bl + -V VID, --VID VID set vendor id (hex) + -P PID, --PID PID set product id (hex) + --be, --6022be use DSO-6022BE firmware + --bl, --6022bl use DSO-6022BL firmware +``` + +This tool can be used to upload the firmware to devices with +[damaged EEPROM content](https://github.com/Ho-Ro/Hantek6022API/discussions/28). +These devices enumerate as Cypress development kit with VID:PID 04b4:8613. + +``` +$ lsusb | grep Cypress +Bus 002 Device 021: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit + +$ ./upload_firmware_6022.py --VID 04b4 --PID 8613 --6022be +upload DSO-6022BE firmware +FW version 0x210 +Serial number CF81BA1F3532 + +$ lsusb | grep Hantek +Bus 002 Device 022: ID 04b5:6022 ROHM LSI Systems USA, LLC Hantek DSO-6022BE ``` ### `reset_eeprom_6022.py` **Warning:** this program will delete all calibration values from EEPROM - use with care! - diff --git a/examples/upload_firmware_6022.py b/examples/upload_firmware_6022.py index 76e3b42..6e5c9e2 100755 --- a/examples/upload_firmware_6022.py +++ b/examples/upload_firmware_6022.py @@ -14,14 +14,14 @@ ap = argparse.ArgumentParser( prog='upload_firmware_6022.py', description='Upload firmware to Hantek6022 devices with different VID:PID' ) -ap.add_argument( '-V', '--VID', type = lambda x: int(x,16), default = 0 ) -ap.add_argument( '-P', '--PID', type = lambda x: int(x,16), default = 0 ) +ap.add_argument( '-V', '--VID', type = lambda x: int(x,16), default = 0, help = 'set vendor id (hex)' ) +ap.add_argument( '-P', '--PID', type = lambda x: int(x,16), default = 0, help = 'set product id (hex)' ) fw = ap.add_mutually_exclusive_group() -fw.add_argument( '--be', '--6022be', action = 'store_true' ) -fw.add_argument( '--bl', '--6022bl', action = 'store_true' ) +fw.add_argument( '--be', '--6022be', action = 'store_true', help = 'use DSO-6022BE firmware' ) +fw.add_argument( '--bl', '--6022bl', action = 'store_true', help = 'use DSO-6022BL firmware' ) options = ap.parse_args() -print( options.VID, options.PID ) + if not options.VID and not options.PID: scope = Oscilloscope() elif options.VID and options.PID and ( options.be or options.bl ): @@ -30,17 +30,24 @@ print( '--VID and --PID and one of --be or --bl must be provided') sys.exit() -scope.setup() +if not scope.setup(): + print( 'scope setup error - no device?' ) + sys.exit( -1 ) + if not scope.open_handle(): - print( 'No device' ) + print( 'scope open error - no device?' ) sys.exit( -1 ) if options.be: + print( 'upload DSO-6022BE firmware' ) scope.flash_firmware( dso6022be_firmware ) elif options.bl: + print( 'upload DSO-6022BL firmware' ) scope.flash_firmware( dso6022bl_firmware ) else: + print( 'upload default firmware' ) scope.flash_firmware() print( "FW version", hex( scope.get_fw_version() ) ) +print( "Serial number", scope.get_serial_number_string() ) scope.close_handle()