sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

Fix double hex to decimal conversion

Open yuazhe opened this issue 1 year ago • 0 comments

What I did

In the previous commit with hash a3cf5c that aimed to address the issue where sfputil incorrectly interpreted page numbers as decimal instead of hexadecimal, there was an inadvertent double conversion from hexadecimal to decimal. For instance, inputting 11 resulted in conversion to 17 and then further to 23. To rectify this, the second conversion would be removed.

How I did it

remove the redundant second conversion

How to verify it

check the eeprom-hexdump output

Previous command output (if the output of a command-line utility has changed)

admin@sonic:~$ sudo sfputil show eeprom-hexdump -p Ethernet0 -n 11
EEPROM hexdump for port Ethernet0 page 17h
        Lower page 0h
        00000000 18 52 00 07 00 00 00 00  00 00 00 00 00 00 34 2f |.R............4/|
        00000010 81 3a 00 00 00 00 00 00  00 00 00 00 00 00 00 ff |.:..............|
        00000020 ff ff ff 00 00 01 00 01  02 00 00 00 00 00 00 00 |................|
        00000030 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000040 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000050 00 00 00 00 00 04 11 03  88 01 0b 02 44 11 0f 03 |............D...|
        00000060 44 11 0d 03 22 55 0a 03  11 ff 05 02 11 ff ff 00 |D..."U..........|
        00000070 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 
        Upper page 0h
        00000080 18 41 4f 49 20 20 20 20  20 20 20 20 20 20 20 20 |.AOI            |
        00000090 20 00 29 26 41 4c 51 41  39 4e 30 33 41 44 4c 41 | .)&ALQA9N03ADLA|
        000000a0 31 35 38 30 31 30 39 39  39 32 33 47 32 35 30 38 |15801099923G2508|
        000000b0 30 41 20 20 20 20 32 33  30 37 30 36 20 20 20 20 |0A    230706    |
        000000c0 20 20 20 20 20 20 20 20  60 20 43 23 00 00 00 00 |        ` C#....|
        000000d0 00 00 00 02 00 00 00 00  00 00 00 00 00 00 db 00 |................|
        000000e0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        000000f0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 
        Upper page 17h = Should be 11h
        00000080 18 41 4f 49 20 20 20 20  20 20 20 20 20 20 20 20 |.AOI            |
        00000090 20 00 29 26 41 4c 51 41  39 4e 30 33 41 44 4c 41 | .)&ALQA9N03ADLA|
        000000a0 31 35 38 30 31 30 39 39  39 32 33 47 32 35 30 38 |15801099923G2508|
        000000b0 30 41 20 20 20 20 32 33  30 37 30 36 20 20 20 20 |0A    230706    |
        000000c0 20 20 20 20 20 20 20 20  60 20 43 23 00 00 00 00 |        ` C#....|
        000000d0 00 00 00 02 00 00 00 00  00 00 00 00 00 00 db 00 |................|
        000000e0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        000000f0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

New command output (if the output of a command-line utility has changed)

EEPROM hexdump for port Ethernet32 page 11h
        Lower page 0h
        00000000 18 40 80 07 00 00 00 00  00 00 00 00 00 00 00 00 |.@..............|
        00000010 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000020 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000030 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000040 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000050 00 00 00 00 00 03 1d 01  88 01 1c 01 44 11 1b 01 |............D...|
        00000060 22 55 1a 01 44 11 18 01  11 ff 17 01 44 11 16 01 |"U..D.......D...|
        00000070 11 ff 01 01 11 ff 00 00  00 00 00 00 00 00 00 00 |................|

        Upper page 0h
        00000080 18 4d 65 6c 6c 61 6e 6f  78 20 20 20 20 20 20 20 |.Mellanox       |
        00000090 20 00 02 c9 4d 43 50 31  36 36 30 2d 57 30 30 41 | ...MCP1660-W00A|
        000000a0 45 33 30 20 41 34 4d 54  32 32 35 31 56 53 30 32 |E30 A4MT2251VS02|
        000000b0 34 33 38 20 20 20 32 32  31 32 31 36 20 20 20 20 |438   221216    |
        000000c0 20 20 20 20 20 20 20 20  00 01 05 23 04 05 07 15 |        ...#....|
        000000d0 00 00 00 02 0a 00 00 00  00 00 00 00 00 00 af 00 |................|
        000000e0 33 30 33 33 30 4b 51 36  54 33 55 37 00 00 00 00 |30330KQ6T3U7....|
        000000f0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

        Upper page 11h
        00000080 18 4d 65 6c 6c 61 6e 6f  78 20 20 20 20 20 20 20 |.Mellanox       |
        00000090 20 00 02 c9 4d 43 50 31  36 36 30 2d 57 30 30 41 | ...MCP1660-W00A|
        000000a0 45 33 30 20 41 34 4d 54  32 32 35 31 56 53 30 32 |E30 A4MT2251VS02|
        000000b0 34 33 38 20 20 20 32 32  31 32 31 36 20 20 20 20 |438   221216    |
        000000c0 20 20 20 20 20 20 20 20  00 01 05 23 04 05 07 15 |        ...#....|
        000000d0 00 00 00 02 0a 00 00 00  00 00 00 00 00 00 af 00 |................|
        000000e0 33 30 33 33 30 4b 51 36  54 33 55 37 00 00 00 00 |30330KQ6T3U7....|
        000000f0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

yuazhe avatar Apr 10 '24 07:04 yuazhe