Do you perhaps need a newline terminator for the line you're writing to the
slots "file"?
On Sunday, December 15, 2013 11:43:21 AM UTC-8, Frank Davidson wrote:
>
> Hi,
>
> I am having a hard time understanding the nature of the "echo
> cape-bone-iio > /sys/devices/bone_capemgr.*/slots"
>
> I have written the following program in Go:
>
> package bbbdevtreeovly
>
> import (
> // "io"
> // "bytes"
> // "fmt"
> "io/ioutil"
> "log"
> "os"
> // "os/exec"
> // "strings"
> "path/filepath"
> )
>
> const (
> slotsDir string = `/sys/devices/` // Find BBB's slots
> )
>
> func Load_dto(dtoFileName string, dtoFilePath string) (err error) {
>
> log.SetPrefix(`BBB Device Tree Overlay: `)
>
> slotFiles := make([]os.FileInfo, 100)
>
> slotFiles, err = ioutil.ReadDir(slotsDir)
>
> var i int
>
> for i = 0; i < len(slotFiles); i++ {
> found, _ := filepath.Match(`bone_capemgr.*`, slotFiles[i].Name())
> if found {
> break
> }
> }
>
> log.Println("This is the new program...", "\n")
>
> slotsLoc := filepath.Join(slotsDir, slotFiles[i].Name(), `slots`)
>
> log.Println("DTO File: ", dtoFileName, "\n")
>
> slots, err := os.Open(slotsLoc)
> if err != nil {
> log.Println(err)
> return err
> }
> defer slots.Close()
>
> log.Println("Slots location: ", slots.Name(), "\n")
>
> slots.Write([]byte(dtoFileName))
>
> // slots.Write([]byte("cape_bone_iio"))
>
> return nil
>
> }
>
> /*
> *
> */
>
> package main
>
> import (
> "davidsonff/fmserve/bbbdevtreeovly"
> "fmt"
> )
>
> func main() {
>
> err := bbbdevtreeovly.Load_dto("cape-bone-iio", "/lib/firmware/")
> if err != nil {
> panic(err)
> }
>
> fmt.Println("Success!")
>
> }
>
>
> The result is no error and no change in the system:
>
> root@beaglebone:~# ./fmserve
> BBB Device Tree Overlay: 2013/12/15 19:25:15 This is the new program...
>
> BBB Device Tree Overlay: 2013/12/15 19:25:15 DTO File: cape-bone-iio
>
> BBB Device Tree Overlay: 2013/12/15 19:25:15 Slots location:
> /sys/devices/bone_capemgr.9/slots
>
> Success!
> root@beaglebone:~# cat /sys/devices/bone_capemgr.9/slots
> 0: 54:PF---
> 1: 55:PF---
> 2: 56:PF---
> 3: 57:PF---
> 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
> 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
>
> It seems to me that the $SLOTS "file" is not a normal file and that I am
> not understanding it properly.
>
> I've seen posts on loading this at boot in a script file, but nothing
> about changing it programmatically... Any help would be appreciated!
>
> Thanks,
>
> Frank
>
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.