Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From e5f68189ab3602b1042cc8423fd6a3a23abd5455 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex James <theracermaster@gmail.com> |
| 3 | Date: Sat, 14 Apr 2018 22:59:57 -0500 |
| 4 | Subject: [PATCH] ch341a_spi: Avoid deprecated libusb functions |
| 5 | |
| 6 | libusb 1.0.22 marked libusb_set_debug as deprecated. For such versions |
| 7 | of libusb, use libusb_set_option instead. |
| 8 | |
| 9 | Change-Id: Ib71ebe812316eaf49136979a942a946ef9e4d487 |
| 10 | Signed-off-by: Alex James <theracermaster@gmail.com> |
| 11 | Reviewed-on: https://review.coreboot.org/25681 |
| 12 | Tested-by: Nico Huber <nico.h@gmx.de> |
| 13 | Reviewed-by: David Hendricks <david.hendricks@gmail.com> |
| 14 | --- |
| 15 | Upstream-Status: Backport |
| 16 | ch341a_spi.c | 7 ++++++- |
| 17 | 1 file changed, 6 insertions(+), 1 deletion(-) |
| 18 | |
| 19 | diff --git a/ch341a_spi.c b/ch341a_spi.c |
| 20 | index 6eb2804..d880510 100644 |
| 21 | --- a/ch341a_spi.c |
| 22 | +++ b/ch341a_spi.c |
| 23 | @@ -444,7 +444,12 @@ int ch341a_spi_init(void) |
| 24 | return -1; |
| 25 | } |
| 26 | |
| 27 | - libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only). |
| 28 | + /* Enable information, warning, and error messages (only). */ |
| 29 | +#if LIBUSB_API_VERSION < 0x01000106 |
| 30 | + libusb_set_debug(NULL, 3); |
| 31 | +#else |
| 32 | + libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO); |
| 33 | +#endif |
| 34 | |
| 35 | uint16_t vid = devs_ch341a_spi[0].vendor_id; |
| 36 | uint16_t pid = devs_ch341a_spi[0].device_id; |
| 37 | -- |
| 38 | 2.17.0 |
| 39 | |