<div dir="ltr"><div>Hi Noel</div><div><br></div><div>Thanks for the technical explanation. One can tell I'm not a programmer ;-)<br></div><div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Following is the correct understanding of the function you referenced in the link:<br>
<br>
* 0x01 = available spare has fallen below threshold<br>
* 0x02 = temperature is above or below threshold<br>
* 0x04 = NVM subsystem reliability has been degraded<br>
* 0x08 = media has been placed in read only mode<br>
* 0x10 = volatile memory backup device has failed<br>
* any other bits set = unknown critical warning(s)<br>
<br>
I just changed the last line.<br>
The unsigned char w, which is a 1 byte (8 bit) value. It holds the set warnings, where each bit can be set or unset, depending on if a warning exists.<br>
E.g. if "available spare has fallen below threshold" and "temperature is above or below threshold" were set, w would have the value 0x3 (just 0x1 and 0x2 ORed together).<br></blockquote><div><br></div><div>That was my assumption, too (0x01 + 0x02 = 0x03). But, according to the existing code, the function will not recognize 0x03 and will output "unknown critical warning(s)", is this correct?</div><div><br></div><div>What about 0x08 + 0x10? That would give 0x18 but is this even possible? Again, not a programmer so trying to understand the interpretation of the bits here. According to <a href="https://stackoverflow.com/questions/46416860/bit-manipulation-using-shifts-as-well-as-and">https://stackoverflow.com/questions/46416860/bit-manipulation-using-shifts-as-well-as-and</a> that would be: <br></div><div><p>3.) Represent 0x18 in binary<br></p><p>0x18 = 0001 1000</p></div><div>So that "looks" actually correct (only 4th and 5th bit are set).</div><div><br></div><div>Any good reference or "conversion table" on this topic would be appreciated, I couldn't find one. <br></div><div><br></div><div>Again thanks Noel, your answer already helped me a lot!<br></div></div></div>