Is there anyone who has recently (or longer ago) used sysutils/flashrom in conjunction with a cheap CH341a-based programmer?
I personally haven't been able to use Flashrom in FreeBSD until I patched it slightly with any of the programmers that I own. Windows-based AsProgrammer worked fine.
So I'd like to know if I'm the only one or this is a common occurrence.
Short story on the patch: the code for all other USB-based programmers that use libusb program without any parallelization. The CH341a code though tries to set up multiple transfers and for some reason this appears not to work. Maybe it's a hardware bug or anything else, but when I patch Flashrom everything works as expected.
Patch that I use:
(second part is to disable quite useless debug output while programming)
I personally haven't been able to use Flashrom in FreeBSD until I patched it slightly with any of the programmers that I own. Windows-based AsProgrammer worked fine.
So I'd like to know if I'm the only one or this is a common occurrence.
Short story on the patch: the code for all other USB-based programmers that use libusb program without any parallelization. The CH341a code though tries to set up multiple transfers and for some reason this appears not to work. Maybe it's a hardware bug or anything else, but when I patch Flashrom everything works as expected.
Patch that I use:
Code:
--- ch341a_spi.c.orig 2024-10-24 15:36:39 UTC
+++ ch341a_spi.c
@@ -70,7 +70,7 @@
/* Number of parallel IN transfers. 32 seems to produce the most stable throughput on Windows. */
-#define USB_IN_TRANSFERS 32
+#define USB_IN_TRANSFERS 1
/* We need to use many queued IN transfers for any resemblance of performance (especially on Windows)
* because USB spec says that transfers end on non-full packets and the device sends the 31 reply
@@ -436,7 +436,7 @@ static int ch341a_spi_init(const struct programmer_cfg
/* Enable information, warning, and error messages (only). */
#if LIBUSB_API_VERSION < 0x01000106
- libusb_set_debug(NULL, 3);
+ libusb_set_debug(NULL, 0);
#else
libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO);
#endif