2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 12:17:44 +00:00

Fix parsing of 6bit ascii

The 6 bit ascii decode was not correctly assembling
the third character in every chunk.  It was incorrectly
masking away the most significant bit before shifting.
Correct the mask to only mask the appropriate bits.

Change-Id: Ib55ce934d2834d53879e64cc44bcf12bef0eef1c
This commit is contained in:
Jarrod Johnson 2015-04-28 14:15:05 -04:00
parent f223ed7849
commit d022c58e61

View File

@ -85,7 +85,7 @@ def unpack6bitascii(inputdata):
currchar = (currchunk[0] & 0b11000000) >> 6
currchar |= (currchunk[1] & 0b1111) << 2
result += chr(0x20 + currchar)
currchar = (currchunk[1] & 0b1111000) >> 4
currchar = (currchunk[1] & 0b11110000) >> 4
currchar |= (currchunk[2] & 0b11) << 4
result += chr(0x20 + currchar)
currchar = (currchunk[2] & 0b11111100) >> 2