1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 04:40:04 +01:00

i2c: added debug logs

This commit is contained in:
Kunal Powar 2014-04-10 07:38:14 +05:30
parent 2ee0cbc899
commit 68ba342e1b

View File

@ -11,6 +11,7 @@ import (
"time"
"unsafe"
"github.com/golang/glog"
"github.com/kidoman/embd"
)
@ -58,6 +59,8 @@ func (b *i2cBus) init() error {
return err
}
glog.V(2).Infof("i2c: bus %v initialized", b.l)
b.initialized = true
return nil
@ -65,6 +68,7 @@ func (b *i2cBus) init() error {
func (b *i2cBus) setAddress(addr byte) error {
if addr != b.addr {
glog.V(2).Infof("i2c: setting bus %v address to %#02x", b.l, addr)
if _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, b.file.Fd(), slaveCmd, uintptr(addr)); errno != 0 {
return syscall.Errno(errno)
}