Signed-off-by: Kai Xia <kaix+github@fastmail.com>
This commit is contained in:
Kai Xia 2026-02-24 21:48:21 +11:00
parent 97ea679a56
commit 338ce20eb4
2 changed files with 9 additions and 5 deletions

View file

@ -95,7 +95,9 @@ func (t *I2CTool) detect() *ToolResult {
} }
if len(matches) == 0 { if len(matches) == 0 {
return SilentResult("No I2C buses found. You may need to:\n1. Load the i2c-dev module: modprobe i2c-dev\n2. Check that I2C is enabled in device tree\n3. Configure pinmux for your board (see hardware skill)") return SilentResult(
"No I2C buses found. You may need to:\n1. Load the i2c-dev module: modprobe i2c-dev\n2. Check that I2C is enabled in device tree\n3. Configure pinmux for your board (see hardware skill)",
)
} }
type busInfo struct { type busInfo struct {
@ -128,7 +130,7 @@ func isValidBusID(id string) bool {
// parseI2CAddress extracts and validates an I2C address from args // parseI2CAddress extracts and validates an I2C address from args
// //
//nolint:unused // Used by i2c_linux.go //nolint:unused // Used by i2c_linux.go
func parseI2CAddress(args map[string]interface{}) (int, *ToolResult) { func parseI2CAddress(args map[string]any) (int, *ToolResult) {
addrFloat, ok := args["address"].(float64) addrFloat, ok := args["address"].(float64)
if !ok { if !ok {
return 0, ErrorResult("address is required (e.g. 0x38 for AHT20)") return 0, ErrorResult("address is required (e.g. 0x38 for AHT20)")
@ -143,7 +145,7 @@ func parseI2CAddress(args map[string]interface{}) (int, *ToolResult) {
// parseI2CBus extracts and validates an I2C bus from args // parseI2CBus extracts and validates an I2C bus from args
// //
//nolint:unused // Used by i2c_linux.go //nolint:unused // Used by i2c_linux.go
func parseI2CBus(args map[string]interface{}) (string, *ToolResult) { func parseI2CBus(args map[string]any) (string, *ToolResult) {
bus, ok := args["bus"].(string) bus, ok := args["bus"].(string)
if !ok || bus == "" { if !ok || bus == "" {
return "", ErrorResult("bus is required (e.g. \"1\" for /dev/i2c-1)") return "", ErrorResult("bus is required (e.g. \"1\" for /dev/i2c-1)")

View file

@ -97,7 +97,9 @@ func (t *SPITool) list() *ToolResult {
} }
if len(matches) == 0 { if len(matches) == 0 {
return SilentResult("No SPI devices found. You may need to:\n1. Enable SPI in device tree\n2. Configure pinmux for your board (see hardware skill)\n3. Check that spidev module is loaded") return SilentResult(
"No SPI devices found. You may need to:\n1. Enable SPI in device tree\n2. Configure pinmux for your board (see hardware skill)\n3. Check that spidev module is loaded",
)
} }
type devInfo struct { type devInfo struct {
@ -122,7 +124,7 @@ func (t *SPITool) list() *ToolResult {
// parseSPIArgs extracts and validates common SPI parameters // parseSPIArgs extracts and validates common SPI parameters
// //
//nolint:unused // Used by spi_linux.go //nolint:unused // Used by spi_linux.go
func parseSPIArgs(args map[string]interface{}) (device string, speed uint32, mode uint8, bits uint8, errMsg string) { func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8, bits uint8, errMsg string) {
dev, ok := args["device"].(string) dev, ok := args["device"].(string)
if !ok || dev == "" { if !ok || dev == "" {
return "", 0, 0, 0, "device is required (e.g. \"2.0\" for /dev/spidev2.0)" return "", 0, 0, 0, "device is required (e.g. \"2.0\" for /dev/spidev2.0)"