scripts: sercomm-pid.py: use uppercase hwid in pid
authorMikhail Zhilkin <csharper2005@gmail.com>
Sun, 12 Nov 2023 07:46:11 +0000 (07:46 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 25 Nov 2023 00:11:18 +0000 (01:11 +0100)
Sercomm uses uppercase for hexadecimal representation of the device
hardware IDs in factory image PID. This commit brings the sercomm-pid.py
script into compliance with the original Sercomm algorithm.

Example
-------
+--------+-------------+-----------+-------------+
| Device | PID (before | PID       | PID (after  |
| HWID   | the commit) | (Sercomm) | the commit) |
+--------+-------------+-----------+-------------+
| CPJ    | 43 50 4a    | 43 50 4A  | 43 50 4A    |
+--------+-------------+-----------+-------------+

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
scripts/sercomm-pid.py

index 4d88a678396f1e8c2d667e5450a9534d3110b534..2c246fc298bd355362166da4926cb40e9864ffad 100755 (executable)
@@ -34,7 +34,7 @@ def get_pid(args):
                enc = args.hw_version.rjust(8, '0').encode('ascii')
                struct.pack_into('>8s', buf, 0x0, enc)
 
-               enc = binascii.hexlify(args.hw_id.encode())
+               enc = binascii.hexlify(args.hw_id.encode()).upper()
                struct.pack_into('>6s', buf, 0x8, enc)
 
        enc = args.sw_version.rjust(4, '0').encode('ascii')