diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2023-04-09 10:01:03 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2023-04-09 10:01:03 +0200 |
commit | 0cdc257b8d371e85133b7f463785785fe5f0aee3 (patch) | |
tree | 35bc4f95eea962b9b3e57b0f18d5ac90ea5e7031 /scripts | |
parent | 8758438c27a88694a1389a42f82b8262d6a92f97 (diff) | |
download | upstream-0cdc257b8d371e85133b7f463785785fe5f0aee3.tar.gz upstream-0cdc257b8d371e85133b7f463785785fe5f0aee3.tar.bz2 upstream-0cdc257b8d371e85133b7f463785785fe5f0aee3.zip |
scripts: sercomm-pid: add bmips support
Apparently, Sercomm sets 2 padding bytes instead of 1 (ramips).
The HW version is a bit different than the one used for ramips.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/sercomm-pid.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/sercomm-pid.py b/scripts/sercomm-pid.py index b89977a5b9..4d88a67839 100755 --- a/scripts/sercomm-pid.py +++ b/scripts/sercomm-pid.py @@ -27,11 +27,15 @@ def create_pid_file(args): def get_pid(args): buf = bytearray([PADDING] * PID_SIZE) - enc = args.hw_version.rjust(8, '0').encode('ascii') - struct.pack_into('>8s', buf, 0x0, enc) + if not args.hw_id: + enc = args.hw_version.rjust(14, '0').encode('ascii') + struct.pack_into('>14s', buf, 0x0, enc) + else: + enc = args.hw_version.rjust(8, '0').encode('ascii') + struct.pack_into('>8s', buf, 0x0, enc) - enc = binascii.hexlify(args.hw_id.encode()) - struct.pack_into('>6s', buf, 0x8, enc) + enc = binascii.hexlify(args.hw_id.encode()) + struct.pack_into('>6s', buf, 0x8, enc) enc = args.sw_version.rjust(4, '0').encode('ascii') struct.pack_into('>4s', buf, 0x64, enc) @@ -41,6 +45,9 @@ def get_pid(args): if (args.extra_padd_byte): struct.pack_into ('<i', tail, 0x0, args.extra_padd_byte) + elif not args.hw_id: + tail[0] = 0x0D + tail[1] = 0x0A buf += tail return buf @@ -91,7 +98,6 @@ def main(): args = parser.parse_args() if ((not args.hw_version) or - (not args.hw_id) or (not args.sw_version) or (not args.pid_file)): parser.print_help() |