diff options
author | Simon Rettberg | 2021-07-02 14:12:54 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-07-02 14:12:54 +0200 |
commit | b60268d835de9fcb06003902f86228862e77e3e7 (patch) | |
tree | 1709e435c5eca4d9117a490c4cc561f2c2bdf6e9 | |
parent | [dev] dev_get_type = 0f is an extended partition too... (diff) | |
download | slx-tools-b60268d835de9fcb06003902f86228862e77e3e7.tar.gz slx-tools-b60268d835de9fcb06003902f86228862e77e3e7.tar.xz slx-tools-b60268d835de9fcb06003902f86228862e77e3e7.zip |
[dev] Add support for xxd without -e
-rw-r--r-- | modules/dev.inc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/dev.inc b/modules/dev.inc index 6d66678..fcde631 100644 --- a/modules/dev.inc +++ b/modules/dev.inc @@ -236,6 +236,8 @@ __init() { hexdump -ve '/4 "%02x"' | sed 's/\(........\)\(........\)/\2\1/' fi } + elif [ "$( printf z2345678 | xxd -g 8 | cut -d' ' -f2 | awk '{ for (i=length-1;i>0;i-=2)x=x substr($0,i,2);}END{print x}' )" = "$t" ]; then + __bin2hex_le() { xxd -g "$1" | cut -d' ' -f2 | awk '{ for (i=length-1;i>0;i-=2)x=x substr($0,i,2);}END{print x}'; } else echo "No suitable tool for converting binary data to little endian hex" >&2 exit 1 |