private static void CheckObjectType(AcpiObject.AcpiObject obj, AcpiObjectType type) { if (obj.ObjectType().Value != (ulong)type) { throw new AmlTypeException(); } }
private static string HidObjectToDeviceId(AcpiObject.AcpiObject obj) { AcpiObject.AcpiObjectType type = (AcpiObject.AcpiObjectType)((AcpiObject.Integer)(obj.ObjectType())).Value; string hid; if (type == AcpiObject.AcpiObjectType.Integer) { // Swap byte order so that all fields are contiguous ulong eisaId = ByteOrder.Swap((uint)(((AcpiObject.Integer)obj).Value)); hid = String.Format("{0}{1}{2}{3:X}{4:X}{5:X}{6:X}", (char)(((eisaId >> 26) & 0x1F) + '@'), (char)(((eisaId >> 21) & 0x1F) + '@'), (char)(((eisaId >> 16) & 0x1F) + '@'), (eisaId >> 12) & 0xF, (eisaId >> 8) & 0xF, (eisaId >> 4) & 0xF, (eisaId >> 0) & 0xF); } else if (type == AcpiObject.AcpiObjectType.String) { hid = ((AcpiObject.String)obj).Value; } else { throw new ArgumentException("_HID object was not an integer or string as expected"); } if (hid.StartsWith("PNP")) { return("/pnp/" + hid); } else { return("/acpi/" + hid); } }