nvram

package module
v0.0.0-...-cb635f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package nvram provides an interface to the Mac NVRAM chips on OS X.

It's built upon the heavily stripped C code of the native nvram tool.

The only type supported for the values is data (arbitrary strings in Go) both reading and writing. Names must be alphanumeric.

Setting requires superuser privileges.

Example
res, err := Get("filippo")
if err != nil {
	log.Fatalln(err.Error())
}

log.Printf("% x\n", res)

err = Set("filippo", "\xff\x0042è\x00\xff")
if err != nil {
	log.Fatalln(err.Error())
}

log.Println("Set done")

res, err = Get("filippo")
if err != nil {
	log.Fatalln(err.Error())
}

log.Printf("% x\n", res)
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(name string) error

func Get

func Get(name string) (string, error)

Get retrieves a value stored with a given name from the NVRAM. The value is returned as a string of bytes, as stored. An emptry string is returned if a value with that name is not found.

func Set

func Set(name string, value string) error

Set stores a value under the given name. Value can be an arbitrary string, name must be alphanumeric.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL