{"id":18694254,"url":"https://github.com/9elements/go-linux-lowlevel-hw","last_synced_at":"2025-04-12T06:54:36.309Z","repository":{"id":40246966,"uuid":"339467894","full_name":"9elements/go-linux-lowlevel-hw","owner":"9elements","description":"Golang library for low level hardware access","archived":false,"fork":false,"pushed_at":"2025-01-26T20:57:57.000Z","size":1096,"stargazers_count":2,"open_issues_count":5,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-12T06:54:30.756Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/9elements.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-16T16:56:38.000Z","updated_at":"2025-01-30T15:16:23.000Z","dependencies_parsed_at":"2024-06-21T16:34:25.761Z","dependency_job_id":"8b5053ba-07a0-4652-9d9c-3ae4307b6971","html_url":"https://github.com/9elements/go-linux-lowlevel-hw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9elements%2Fgo-linux-lowlevel-hw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9elements%2Fgo-linux-lowlevel-hw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9elements%2Fgo-linux-lowlevel-hw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9elements%2Fgo-linux-lowlevel-hw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9elements","download_url":"https://codeload.github.com/9elements/go-linux-lowlevel-hw/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530585,"owners_count":21119595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T11:09:03.860Z","updated_at":"2025-04-12T06:54:36.272Z","avatar_url":"https://github.com/9elements.png","language":"Go","readme":"\r\n![image](assets/logo.png)\r\n\r\ngo-linux-lowevel-hw provides low level access to common hardware on UNIX like platforms.\r\n\r\nDescription\r\n-----------\r\nThis package provides low level access to certain hardware typically found\r\non modern x86 PCs. Some information are only available when run as\r\nmost priviledged user. Thus this library is to be used in preproduction\r\nand testing envirnoments with relaxed kernel security.\r\n\r\n**Be warned, you could brick your system.**\r\n\r\nHow to use this library\r\n-----------------------\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n\r\n\t\"github.com/9elements/go-linux-lowlevel-hw/pkg/hwapi\"\r\n)\r\n\r\nfunc main() {\r\n\th := hwapi.GetAPI()\r\n\r\n\t//...\r\n}\r\n```\r\n\r\nInterfaces\r\n----------\r\nThe GetAPI call returns an interface providing the following methods:\r\n```\r\n\t// cpuid.go\r\n\tVersionString() string\r\n\tHasSMX() bool\r\n\tHasVMX() bool\r\n\tHasMTRR() bool\r\n\tProcessorBrandName() string\r\n\tCPUSignature() uint32\r\n\tCPULogCount() uint32\r\n\r\n\t// e820.go\r\n\tIsReservedInE820(start uint64, end uint64) (bool, error)\r\n\r\n\t// iommu.go\r\n\tLookupIOAddress(addr uint64, regs VTdRegisters) ([]uint64, error)\r\n\tAddressRangesIsDMAProtected(first, end uint64) (bool, error)\r\n\r\n\t// msr.go\r\n\tReadMSR(msr int64) (uint64, error)\r\n\tReadMSRAllCores(msr int64) (uint64, error)\r\n\r\n\t// msr_intel.go\r\n\tHasSMRR() (bool, error)\r\n\tGetSMRRInfo() (SMRR, error)\r\n\tIA32FeatureControlIsLocked() (bool, error)\r\n\tIA32PlatformID() (uint64, error)\r\n\tAllowsVMXInSMX() (bool, error)\r\n\tTXTLeavesAreEnabled() (bool, error)\r\n\tIA32DebugInterfaceEnabledOrLocked() (*IA32Debug, error)\r\n\r\n\t// pci.go\r\n\tPCIEnumerateVisibleDevices(cb func(d PCIDevice) (abort bool)) (err error)\r\n\tPCIReadConfig8(d PCIDevice, off int) (uint8, error)\r\n\tPCIReadConfig16(d PCIDevice, off int) (uint16, error)\r\n\tPCIReadConfig32(d PCIDevice, off int) (uint32, error)\r\n\tPCIWriteConfig8(d PCIDevice, off int, val uint8) error\r\n\tPCIWriteConfig16(d PCIDevice, off int, val uint16) error\r\n\tPCIWriteConfig32(d PCIDevice, off int, val uint32) error\r\n\tPCIReadVendorID(d PCIDevice) (uint16, error)\r\n\tPCIReadDeviceID(d PCIDevice) (uint16, error)\r\n\r\n\t// hostbridge.go\r\n\tReadHostBridgeTseg() (uint32, uint32, error)\r\n\tReadHostBridgeDPR() (DMAProtectedRange, error)\r\n\r\n\t// phys.go\r\n\tReadPhys(addr int64, data UintN) error\r\n\tReadPhysBuf(addr int64, buf []byte) error\r\n\tWritePhys(addr int64, data UintN) error\r\n\r\n\t// tpm.go\r\n\tNewTPM() (*TPM, error)\r\n\tNVLocked(tpmCon *TPM) (bool, error)\r\n\tReadNVPublic(tpmCon *TPM, index uint32) ([]byte, error)\r\n\tNVReadValue(tpmCon *TPM, index uint32, password string, size, offhandle uint32) ([]byte, error)\r\n\tReadPCR(tpmCon *TPM, pcr uint32) ([]byte, error)\r\n\r\n\t// acpi.go\r\n\tGetACPITableDevMem(n string) ([]byte, error)\r\n\tGetACPITableSysFS(n string) ([]byte, error)\r\n\r\n\t// smbios.go\r\n\tIterateOverSMBIOSTables(n uint8, callback func(s *smbios.Structure) bool) (ret bool, err error)\r\n\tIterateOverSMBIOSTablesType0(callback func(t0 *SMBIOSType0) bool) (ret bool, err error)\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9elements%2Fgo-linux-lowlevel-hw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9elements%2Fgo-linux-lowlevel-hw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9elements%2Fgo-linux-lowlevel-hw/lists"}