Attention is currently required from: Thomas Heijligen, Nicholas Chin.
Patch set 2:Code-Review +1
6 comments:
File ch347_spi.c:
#define CH347_CMD_SPI_CFG 0xC0
#define CH347_CMD_SPI_CS_CTRL 0xC1
#define CH347_CMD_SPI_OUT_IN 0xC2
#define CH347_CMD_SPI_IN 0xC3
#define CH347_CMD_SPI_OUT 0xC4
Suggestion: use tabs to align the hex values?
```
#define CH347_CMD_SPI_CFG 0xC0
#define CH347_CMD_SPI_CS_CTRL 0xC1
#define CH347_CMD_SPI_OUT_IN 0xC2
#define CH347_CMD_SPI_IN 0xC3
#define CH347_CMD_SPI_OUT 0xC4
```
Patch Set #2, Line 48: static struct libusb_device_handle *handle = NULL;
There have been changes to other programmers to pass this kind of data around through the flashctx. It'd be nice to do so here as well.
Do you need to specify the array size? Or is this hardcoded because the code below only tries opening a device with this ID?
uint8_t cmd[13] = {0};
cmd[0] = CH347_CMD_SPI_CS_CTRL;
/* payload length, uint16 LSB: 10 */
cmd[1] = 10;
cmd[3] = cs1;
cmd[8] = cs2;
How about:
```
uint8_t cmd[13] = {
[0] = CH347_CMD_SPI_CS_CTRL,
/* payload length, uint16 LSB: 10 */
[1] = 10,
[3] = cs1,
[8] = cs2,
};
```
nit: trailing space
uint16_t vid = devs_ch347_spi[0].vendor_id;
uint16_t pid = devs_ch347_spi[0].device_id;
handle = libusb_open_device_with_vid_pid(NULL, vid, pid);
if (handle == NULL) {
msg_perr("Couldn't open device %04x:%04x.\n", vid, pid);
return -1;
}
Does the CH341A code do the same? It should be fine as long as there's only one VID/DID in the list.
To view, visit change 70573. To unsubscribe, or for help writing mail filters, visit settings.