Don't use analog slot before it's ready
This commit is contained in:
parent
b856655be6
commit
7eae6ebe23
|
@ -135,8 +135,6 @@ func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor {
|
|||
|
||||
g, _ := glob(ocp)
|
||||
b.ocp = g[0]
|
||||
g, _ = glob(fmt.Sprintf("%v/helper.*", b.ocp))
|
||||
b.helper = g[0]
|
||||
g, _ = glob(slots)
|
||||
b.slots = fmt.Sprintf("%v/slots", g[0])
|
||||
|
||||
|
@ -148,6 +146,10 @@ func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor {
|
|||
func (b *BeagleboneAdaptor) Connect() bool {
|
||||
ensureSlot(b.slots, "cape-bone-iio")
|
||||
ensureSlot(b.slots, "am33xx_pwm")
|
||||
|
||||
g, _ := glob(fmt.Sprintf("%v/helper.*", b.ocp))
|
||||
b.helper = g[0]
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,11 @@ func TestBeagleboneAdaptor(t *testing.T) {
|
|||
a := NewBeagleboneAdaptor("myAdaptor")
|
||||
a.slots = "/sys/devices/bone_capemgr.4"
|
||||
a.ocp = "/sys/devices/ocp.3"
|
||||
a.helper = "/sys/devices/ocp.3/helper.5"
|
||||
|
||||
a.Connect()
|
||||
|
||||
a.helper = "/sys/devices/ocp.3/helper.5"
|
||||
|
||||
// PWM
|
||||
glob = func(pattern string) (matches []string, err error) {
|
||||
pattern = strings.TrimSuffix(pattern, "*")
|
||||
|
|
Loading…
Reference in New Issue