20 #define LIBSMBIOS_SOURCE
37 for (
u32 i = 0; i < count; ++i)
39 target[i] = cmos.
readByte (indexPort, dataPort, offset + i);
48 for (
u32 i = 0; i < count; ++i)
50 cmos.
writeByte (indexPort, dataPort, offset + i, source[i]);
66 Suppressable::Suppressable()
67 : suppressNotify(false)
122 u32 realOffset = indexPort * 256 + offset;
124 string errMessage(
"Could not open CMOS file(" +
fileName +
") for reading: ");
126 FILE *fh = fopen (
fileName.c_str (),
"rb");
128 throw smbios::InternalErrorImpl(errMessage + strerror(errno));
130 fseek (fh, static_cast<long>(realOffset), SEEK_SET);
131 size_t numBytes = fread (&retval, 1,
sizeof (retval), fh);
133 if (numBytes !=
sizeof(retval))
134 throw std::exception();
144 u32 realOffset = indexPort * 256 + offset;
146 string errMessage(
"Could not open CMOS file(" +
fileName +
") for writing: ");
148 FILE *fh = fopen (
fileName.c_str (),
"r+b");
150 throw smbios::InternalErrorImpl(errMessage + strerror(errno));
152 fseek (fh, static_cast<long>(realOffset), SEEK_SET);
153 fwrite (&byte, 1,
sizeof (byte), fh);