From ad454c1c29af6116f425e17f6472b7b3e03cfe9b Mon Sep 17 00:00:00 2001 From: George Sexton Date: Mon, 9 Sep 2024 12:53:46 -0600 Subject: [PATCH] Remove String() funcs made for debugging since they're not really needed. --- gpioioctl/ioctl.go | 64 ---------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/gpioioctl/ioctl.go b/gpioioctl/ioctl.go index b728e01..e23e828 100644 --- a/gpioioctl/ioctl.go +++ b/gpioioctl/ioctl.go @@ -11,7 +11,6 @@ package gpioioctl // https://docs.kernel.org/userspace-api/gpio/index.html import ( "errors" - "fmt" "syscall" "unsafe" ) @@ -81,10 +80,6 @@ type gpiochip_info struct { lines uint32 } -func (ci *gpiochip_info) String() string { - return fmt.Sprintf("{\"Name\": \"%s\", \"Label\": \"%s\", \"Lines\": %d}", string(ci.name[:]), string(ci.label[:]), ci.lines) -} - type gpio_v2_line_attribute struct { id uint32 padding uint32 @@ -131,65 +126,6 @@ type gpio_v2_line_info struct { padding [4]uint32 } -func (li *gpio_v2_line_info) String() string { - FLAG_LIST := [...]uint64{ - _GPIO_V2_LINE_FLAG_USED, - _GPIO_V2_LINE_FLAG_ACTIVE_LOW, - _GPIO_V2_LINE_FLAG_INPUT, - _GPIO_V2_LINE_FLAG_OUTPUT, - _GPIO_V2_LINE_FLAG_EDGE_RISING, - _GPIO_V2_LINE_FLAG_EDGE_FALLING, - _GPIO_V2_LINE_FLAG_OPEN_DRAIN, - _GPIO_V2_LINE_FLAG_OPEN_SOURCE, - _GPIO_V2_LINE_FLAG_BIAS_PULL_UP, - _GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN, - _GPIO_V2_LINE_FLAG_BIAS_DISABLED, - _GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME, - _GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE, - } - FLAG_NAMES := [...][2]string{ - {"USED", "UNUSED"}, - {"ACTIVE_LOW", ""}, - {"INPUT", ""}, - {"OUTPUT", ""}, - {"EDGE_RISING", ""}, - {"EDGE_FALLING", ""}, - {"OPEN_DRAIN", ""}, - {"OPEN_SOURCE", ""}, - {"PULL_UP", ""}, - {"PULL_DOWN", ""}, - {"BIAS DISABLED", ""}, - {"EVENT_CLOCK_REALTIME", ""}, - {"EVENT_CLOCK_HTE", ""}, - } - - name := string(li.name[:]) - consumer := string(li.consumer[:]) - attr_string := "[" - for attr := 0; attr < int(li.num_attrs); attr++ { - attr_string = attr_string + fmt.Sprintf("{id: %x, value: %x},", li.attrs[attr].id, li.attrs[attr].value) - } - attr_string = attr_string + "]" - flag_str := "" - for i := range FLAG_LIST { - - if li.flags&FLAG_LIST[i] == FLAG_LIST[i] { - flag_str += FLAG_NAMES[i][0] + " " - } else { - if len(FLAG_NAMES[i][1]) > 0 { - flag_str += FLAG_NAMES[i][1] + " " - } - } - } - return fmt.Sprintf("{\"Name\": \"%s\", \"Consumer\": \"%s\", \"Offset\": %d, \"# Attrs\": %d, \"Flags\": \"%s\" 0x%x, \"Attributes\": \"%s\"}", - name, consumer, - li.offset, - li.num_attrs, - flag_str, - li.flags, - attr_string) -} - type gpio_v2_line_event struct { Timestamp_ns uint64 Id uint32