aboutsummaryrefslogtreecommitdiff
path: root/pickit2_spi.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2016-02-22 08:59:15 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2016-02-22 08:59:15 +0000
commit591d7903c46ebe0d547f61eb66b68705cbc12e8a (patch)
tree9f953f0e2f4f36c96cf16214e5ce303b7ea7b777 /pickit2_spi.c
parent8721cd5fdee9a1a34624e967b6e43b184f1604d6 (diff)
pickit2_spi: use ordinary USB devs array
Even though there is currently only one USB device ID in the wild using our standard way to define the devices creates nicer output for -L and -z. Corresponding to flashrom svn r1941. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'pickit2_spi.c')
-rw-r--r--pickit2_spi.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/pickit2_spi.c b/pickit2_spi.c
index e5f7bed..f1f60a2 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -55,6 +55,12 @@
#include "programmer.h"
#include "spi.h"
+const struct dev_entry devs_pickit2_spi[] = {
+ {0x04D8, 0x0033, OK, "Microchip", "PICkit 2"},
+
+ {}
+};
+
static usb_dev_handle *pickit2_handle;
/* Default USB transaction timeout in ms */
@@ -64,9 +70,6 @@ static usb_dev_handle *pickit2_handle;
#define ENDPOINT_OUT 0x01
#define ENDPOINT_IN 0x81
-#define PICKIT2_VID 0x04D8
-#define PICKIT2_PID 0x0033
-
#define CMD_GET_VERSION 0x76
#define CMD_SET_VDD 0xA0
#define CMD_SET_VPP 0xA1
@@ -448,7 +451,9 @@ int pickit2_spi_init(void)
usb_init();
(void)usb_find_busses();
(void)usb_find_devices();
- struct usb_device *dev = get_device_by_vid_pid(PICKIT2_VID, PICKIT2_PID, usedevice);
+ const uint16_t vid = devs_pickit2_spi[0].vendor_id;
+ const uint16_t pid = devs_pickit2_spi[0].device_id;
+ struct usb_device *dev = get_device_by_vid_pid(vid, pid, usedevice);
if (dev == NULL) {
msg_perr("Could not find a PICkit2 on USB!\n");
return 1;