Skip to content

Commit

Permalink
enable setting MACAddr for cyw43439
Browse files Browse the repository at this point in the history
taigrr authored and deadprogram committed Aug 14, 2024

Verified

This commit was signed with the committer’s verified signature.
Zorbatron Zorbatron
1 parent a668e1b commit f39483a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions hci_cyw43439.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build cyw43439

package bluetooth

const (
ogfVendor = 0x3f

ocfSetBTMACAddr = 0x0001
)

func (a *Adapter) SetBdAddr(address Address) error {
return a.hci.setBdAddr(address)
}

func (h *hci) setBdAddr(address Address) error {
hciPacket := make([]byte, len(address.MACAddress.MAC))
// Reverse the byte order as per spec
for i := range address.MACAddress.MAC {
hciPacket[i] = address.MACAddress.MAC[len(address.MACAddress.MAC)-1-i]
}

if err := h.sendWithoutResponse(ogfVendor<<ogfCommandPos|ocfSetBTMACAddr, hciPacket); err != nil {
return err
}

return nil
}

0 comments on commit f39483a

Please sign in to comment.