func (d *RaspberryPiDTDriver) BoardRevision() pinoutRevision {
	revision := CpuInfo(0, "Revision")
	switch revision {
	case "0002", "0003":
		return type0ne
	case "0010":
		return typeAplusBPlusZeroPi2
	}
	revision = CpuInfo(0, "CPU revision")
	switch revision {
	case "5":
		return typeAplusBPlusZeroPi2
	case "7":  
		return typeAplusBPlusZeroPi2
	}
	return typeTwo
}
Determine the version of Raspberry Pi.
This discussion http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=23989
was used to determine the algorithm, specifically the comment by gordon@drogon.net
It will return 1 or 2.
package hwio
import (
	"os/exec"
	"strings"
)
type pinoutRevision int
const (
	type0ne = iota
	typeTwo
	typeAplusBPlusZeroPi2
)
type RaspberryPiDTDriver struct {  
	pinConfigs []*DTPinConfig
	modules map[string]Module
}
func NewRaspPiDTDriver() *RaspberryPiDTDriver {
	return &RaspberryPiDTDriver{}
}
func (d *RaspberryPiDTDriver) MatchesHardwareConfig() bool {
	cpuinfo, e := exec.Command("cat", "/proc/cpuinfo").Output()
	if e != nil {
		return false
	}
	s := string(cpuinfo)
	if strings.Contains(s, "BCM2708") || strings.Contains(s, "BCM2709") || strings.Contains(s, "BCM2835") {
		return true
	}
	return false
}
func (d *RaspberryPiDTDriver) Init() error {
	d.createPinData()
	d.initialiseModules()
	return nil
}
func (d *RaspberryPiDTDriver) createPinData() {
	switch d.BoardRevision() {
	case type0ne:
		d.pinConfigs = []*DTPinConfig{
			{[]string{"null"}, []string{"unassignable"}, 0, 0},  
			{[]string{"3.3v"}, []string{"unassignable"}, 0, 0},
			{[]string{"5v"}, []string{"unassignable"}, 0, 0},
			{[]string{"sda"}, []string{"i2c"}, 0, 0},
			{[]string{"do-not-connect-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"scl"}, []string{"i2c"}, 0, 0},
			{[]string{"ground"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio4"}, []string{"gpio"}, 4, 0},
			{[]string{"txd"}, []string{"serial"}, 0, 0},
			{[]string{"do-not-connect-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"rxd"}, []string{"serial"}, 0, 0},
			{[]string{"gpio17"}, []string{"gpio"}, 17, 0},
			{[]string{"gpio18"}, []string{"gpio"}, 18, 0},  
			{[]string{"gpio21"}, []string{"gpio"}, 21, 0},
			{[]string{"do-not-connect-3"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio22"}, []string{"gpio"}, 22, 0},
			{[]string{"gpio23"}, []string{"gpio"}, 23, 0},
			{[]string{"do-not-connect-4"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio24"}, []string{"gpio"}, 24, 0},
			{[]string{"mosi"}, []string{"spi"}, 0, 0},
			{[]string{"do-not-connect-5"}, []string{"unassignable"}, 0, 0},
			{[]string{"miso"}, []string{"spi"}, 0, 0},
			{[]string{"gpio25"}, []string{"gpio"}, 25, 0},
			{[]string{"sclk"}, []string{"spi"}, 0, 0},
			{[]string{"ce0n"}, []string{"spi"}, 0, 0},
			{[]string{"do-not-connect-6"}, []string{"unassignable"}, 0, 0},
			{[]string{"ce1n"}, []string{"spi"}, 0, 0},
		}
	case typeTwo:
		d.pinConfigs = []*DTPinConfig{
			{[]string{"null"}, []string{"unassignable"}, 0, 0},  
			{[]string{"3.3v-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"5v-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"sda"}, []string{"i2c"}, 0, 0},
			{[]string{"5v-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"scl"}, []string{"i2c"}, 0, 0},
			{[]string{"ground-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio4"}, []string{"gpio"}, 4, 0},
			{[]string{"txd"}, []string{"serial"}, 0, 0},
			{[]string{"ground-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"rxd"}, []string{"serial"}, 0, 0},
			{[]string{"gpio17"}, []string{"gpio"}, 17, 0},
			{[]string{"gpio18"}, []string{"gpio"}, 18, 0},  
			{[]string{"gpio27"}, []string{"gpio"}, 27, 0},
			{[]string{"ground-3"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio22"}, []string{"gpio"}, 22, 0},
			{[]string{"gpio23"}, []string{"gpio"}, 23, 0},
			{[]string{"3.3v-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio24"}, []string{"gpio"}, 24, 0},
			{[]string{"mosi"}, []string{"spi"}, 0, 0},
			{[]string{"ground-4"}, []string{"unassignable"}, 0, 0},
			{[]string{"miso"}, []string{"spi"}, 0, 0},
			{[]string{"gpio25"}, []string{"gpio"}, 25, 0},
			{[]string{"sclk"}, []string{"spi"}, 0, 0},
			{[]string{"gpio8"}, []string{"gpio"}, 8, 0},
			{[]string{"ground-5"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio7"}, []string{"gpio"}, 7, 0},
		}
	case typeAplusBPlusZeroPi2:  
		d.pinConfigs = []*DTPinConfig{
			{[]string{"null"}, []string{"unassignable"}, 0, 0},  
			{[]string{"3.3v-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"5v-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"sda"}, []string{"i2c"}, 0, 0},
			{[]string{"5v-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"scl"}, []string{"i2c"}, 0, 0},
			{[]string{"ground-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio4"}, []string{"gpio"}, 4, 0},
			{[]string{"txd"}, []string{"serial"}, 0, 0},
			{[]string{"ground-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"rxd"}, []string{"serial"}, 0, 0},
			{[]string{"gpio17"}, []string{"gpio"}, 17, 0},
			{[]string{"gpio18"}, []string{"gpio"}, 18, 0},  
			{[]string{"gpio27"}, []string{"gpio"}, 21, 0},
			{[]string{"ground-3"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio22"}, []string{"gpio"}, 22, 0},
			{[]string{"gpio23"}, []string{"gpio"}, 23, 0},
			{[]string{"3.3v-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio24"}, []string{"gpio"}, 24, 0},
			{[]string{"mosi"}, []string{"spi"}, 0, 0},
			{[]string{"ground-4"}, []string{"unassignable"}, 0, 0},
			{[]string{"miso"}, []string{"spi"}, 0, 0},
			{[]string{"gpio25"}, []string{"gpio"}, 25, 0},
			{[]string{"sclk"}, []string{"spi"}, 0, 0},
			{[]string{"gpio8"}, []string{"gpio"}, 8, 0},
			{[]string{"ground-5"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio7"}, []string{"gpio"}, 7, 0},
			{[]string{"do-not-connect-1"}, []string{"unassignable"}, 0, 0},
			{[]string{"do-not-connect-2"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio5"}, []string{"gpio"}, 5, 0},
			{[]string{"ground-6"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio6"}, []string{"gpio"}, 6, 0},
			{[]string{"gpio12"}, []string{"gpio"}, 12, 0},
			{[]string{"gpio13"}, []string{"gpio"}, 13, 0},
			{[]string{"ground-7"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio19"}, []string{"gpio"}, 19, 0},
			{[]string{"gpio16"}, []string{"gpio"}, 16, 0},
			{[]string{"gpio26"}, []string{"gpio"}, 26, 0},
			{[]string{"gpio20"}, []string{"gpio"}, 20, 0},
			{[]string{"ground-8"}, []string{"unassignable"}, 0, 0},
			{[]string{"gpio21"}, []string{"gpio"}, 21, 0},
		}
	}
}
func (d *RaspberryPiDTDriver) initialiseModules() error {
	d.modules = make(map[string]Module)
	gpio := NewDTGPIOModule("gpio")
	e := gpio.SetOptions(d.getGPIOOptions())
	if e != nil {
		return e
	}
	i2c := NewDTI2CModule("i2c")
	e = i2c.SetOptions(d.getI2COptions())
	if e != nil {
		return e
	}
	leds := NewDTLEDModule("leds")
	e = leds.SetOptions(d.getLEDOptions("leds"))
	if e != nil {
		return e
	}
	d.modules["gpio"] = gpio
	d.modules["i2c"] = i2c
	d.modules["leds"] = leds
	return nil
}
func (d *RaspberryPiDTDriver) getGPIOOptions() map[string]interface{} {
	result := make(map[string]interface{})
	pins := make(DTGPIOModulePinDefMap)
	for i, hw := range d.pinConfigs {
		if hw.modules[0] == "gpio" {
			pins[Pin(i)] = &DTGPIOModulePinDef{pin: Pin(i), gpioLogical: hw.gpioLogical}
		}
	}
	result["pins"] = pins
	return result
}
func (d *RaspberryPiDTDriver) getI2COptions() map[string]interface{} {
	result := make(map[string]interface{})
	pins := make(DTI2CModulePins, 0)
	pins = append(pins, Pin(3))
	pins = append(pins, Pin(5))
	result["pins"] = pins
	if d.BoardRevision() ==  type0ne {
		result["device"] = "/dev/i2c-0"
	} else {
		result["device"] = "/dev/i2c-1"
	}
	return result
}
func (d *RaspberryPiDTDriver) getLEDOptions(name string) map[string]interface{} {
	result := make(map[string]interface{})
	pins := make(DTLEDModulePins)
	pins["ok"] = "/sys/class/leds/led0/"
	result["pins"] = pins
	return result
}