diff --git a/platforms/beaglebone/beaglebone_adaptor.go b/platforms/beaglebone/beaglebone_adaptor.go index 779edfb6..72d0c099 100644 --- a/platforms/beaglebone/beaglebone_adaptor.go +++ b/platforms/beaglebone/beaglebone_adaptor.go @@ -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 } diff --git a/platforms/beaglebone/beaglebone_adaptor_test.go b/platforms/beaglebone/beaglebone_adaptor_test.go index 4cadf671..6cb22a80 100644 --- a/platforms/beaglebone/beaglebone_adaptor_test.go +++ b/platforms/beaglebone/beaglebone_adaptor_test.go @@ -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, "*")