Attention is currently required from: Stefan Reinauer, Edward O'Callaghan, Angel Pons.
9 comments:
Commit Message:
Patch Set #1, Line 10: some SBC
Which one have you tested this on?
raspberry pi zero w
W25Q128.V
File Makefile:
Both meson.* and the Makefile needs modifying as well unfortunately.
Done
File sysfsgpio.c:
Patch Set #1, Line 36: #define GPIO_DIRECTION "/sys/class/gpio/gpio%d/direction"
The only definition that gets used twice is `GPIO_PATH`. The others are only used once.
Done
Patch Set #1, Line 38: #define EXIST_PATH(path) (access((path), F_OK) == 0
It's only used twice, so I don't think this provides any benefit. […]
Done
Patch Set #1, Line 42: int pin;
Looks like the code only uses the string representation of `pin`. […]
Remove the pin number of the integer, use a string to record the pin number
static struct pin_desc pin_cs = {
.name = "cs",
.fd_direction = -1,
.fd_value = -1
};
static struct pin_desc pin_sck = {
.name = "sck",
.fd_direction = -1,
.fd_value = -1
};
static struct pin_desc pin_mosi = {
.name = "mosi",
.fd_direction = -1,
.fd_value = -1
};
static struct pin_desc pin_miso = {
.name = "miso",
.fd_direction = -1,
.fd_value = -1
};
I would suggest making another struct to hold all pins in a single global variable: […]
Done
Patch Set #1, Line 80: if (ret == (int)strlen(str))
To avoid casting to int, I would test for failure here with `ret < strlen(str)`.
I tried it, and the compilation still reports an error
Patch Set #1, Line 92: snprintf(s, sizeof(s), "%d", desc->pin);
If you can avoid clobbering the buffer contents with this snprintf call (see suggestion to use a `pi […]
Done
/* parameter format: pins=cs_pin:sck_pin:mosi_pin:miso_pin */
char *pins = extract_programmer_param("pins");
int pins_inited = 0;
do {
struct pin_desc *pins_tab[] = {
&pin_cs, &pin_sck, &pin_mosi, &pin_miso
};
if (!(pins && strlen(pins)))
break;
char *token = strtok(pins, ":");
for (unsigned i = 0; i < ARRAY_SIZE(pins_tab); i++) {
long v;
if (!token)
break;
if (atoi_s(token, 1, &v))
break;
pins_tab[i]->pin = v;
if (export_sysfsgpio(pins_tab[i]))
break;
token = strtok(NULL, ":");
pins_inited = (i + 1 == ARRAY_SIZE(pins_tab));
}
} while (0);
if (pins)
free(pins);
if (!pins_inited)
return 1;
I suggest making this its own static fn for param extraction and pass in &pin_desc to fetch out the […]
The pin information can be extracted into the global variable pins. So not need pass parameters
To view, visit change 49254. To unsubscribe, or for help writing mail filters, visit settings.