mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 00:11:13 +00:00
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>
This commit is contained in:
parent
8758438c27
commit
0cdc257b8d
@ -27,6 +27,10 @@ def create_pid_file(args):
|
|||||||
def get_pid(args):
|
def get_pid(args):
|
||||||
buf = bytearray([PADDING] * PID_SIZE)
|
buf = bytearray([PADDING] * PID_SIZE)
|
||||||
|
|
||||||
|
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')
|
enc = args.hw_version.rjust(8, '0').encode('ascii')
|
||||||
struct.pack_into('>8s', buf, 0x0, enc)
|
struct.pack_into('>8s', buf, 0x0, enc)
|
||||||
|
|
||||||
@ -41,6 +45,9 @@ def get_pid(args):
|
|||||||
if (args.extra_padd_byte):
|
if (args.extra_padd_byte):
|
||||||
struct.pack_into ('<i', tail, 0x0,
|
struct.pack_into ('<i', tail, 0x0,
|
||||||
args.extra_padd_byte)
|
args.extra_padd_byte)
|
||||||
|
elif not args.hw_id:
|
||||||
|
tail[0] = 0x0D
|
||||||
|
tail[1] = 0x0A
|
||||||
buf += tail
|
buf += tail
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
@ -91,7 +98,6 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if ((not args.hw_version) or
|
if ((not args.hw_version) or
|
||||||
(not args.hw_id) or
|
|
||||||
(not args.sw_version) or
|
(not args.sw_version) or
|
||||||
(not args.pid_file)):
|
(not args.pid_file)):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
Loading…
Reference in New Issue
Block a user