summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-04-13 17:26:36 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-15 15:09:08 -0700
commitb28ed970c4fab168dcc9fe2fb00d5c76de4de3fe (patch)
treed740d063fcfa39835ef603bdacebcd4da31401fd /extra
parentde45353bbdf0c6c4afb88420d3cb2e182eae7450 (diff)
downloadchrome-ec-b28ed970c4fab168dcc9fe2fb00d5c76de4de3fe.tar.gz
Cr50: Update the USB VID:PID:subclass constants
The device-specific subclass used for Non-HC firmware updates is in the spreadsheet now, so we can rename the macros to be "official". BUG=chrome-os-partner:49962 BRANCH=none TEST=make buildall; test on cr50 make BOARD=cr50 (plus whatever signing magic works for you) make -C extra/usb_updater ./extra/usb_updater/usb_updater build/cr50/ec.bin (sudo if needed) Note that you may need to rebuild ec.bin in order to see any difference after the update. If the A & B images are identical, the RO bootloader always picks A. Change-Id: I385ce89a9abe2059d52da2d82a0b92b9b3e3c93f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/339220 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/usb_updater/Makefile4
-rw-r--r--extra/usb_updater/usb_updater.c25
2 files changed, 19 insertions, 10 deletions
diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile
index 8a55f750f6..b4c208f4af 100644
--- a/extra/usb_updater/Makefile
+++ b/extra/usb_updater/Makefile
@@ -25,7 +25,9 @@ CFLAGS := -std=gnu99 \
LIBS += $(shell pkg-config --libs libusb-1.0) -lcrypto
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
-CFLAGS += -I../../board/cr50 -I ../../chip/g -I../../util
+# NOTE: This may be board-specific
+BOARD ?= cr50
+CFLAGS += -I../../include -I../../board/$(BOARD) -I ../../chip/g -I../../util
$(PROGRAM): $(SOURCE) Makefile
gcc $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index f1183de852..2b528779d2 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -15,15 +15,22 @@
#include <sys/types.h>
#include <unistd.h>
+
+#ifndef __packed
+#define __packed __attribute__((packed))
+#endif
+
#include "misc_util.h"
-#include "usb_upgrade.h"
+#include "usb_descriptor.h"
+#include "upgrade_fw.h"
#include "config_chip.h"
+#include "board.h"
-/* Google Cr50 */
-#define VID 0x18d1
-#define PID 0x5014
-#define SUBCLASS UNOFFICIAL_USB_SUBCLASS_GOOGLE_CR50
-#define PROTOCOL 0xff
+/* Look for Cr50 FW update interface */
+#define VID USB_VID_GOOGLE
+#define PID CONFIG_USB_PID
+#define SUBCLASS USB_SUBCLASS_GOOGLE_CR50
+#define PROTOCOL USB_PROTOCOL_GOOGLE_CR50_NON_HC_FW_UPDATE
/* Globals */
static char *progname;
@@ -211,8 +218,8 @@ static int parse_vidpid(const char *input, uint16_t *vid_ptr, uint16_t *pid_ptr)
}
-static struct libusb_device_handle *usb_connect(uint16_t vid, uint16_t pid,
- uint8_t *ep_num, int *chunk_len)
+static struct libusb_device_handle *usb_findit(uint16_t vid, uint16_t pid,
+ uint8_t *ep_num, int *chunk_len)
{
struct libusb_device_handle *devh;
int iface_num, r;
@@ -442,7 +449,7 @@ int main(int argc, char *argv[])
exit(1);
}
- devh = usb_connect(vid, pid, &ep_num, &chunk_len);
+ devh = usb_findit(vid, pid, &ep_num, &chunk_len);
transfer_and_reboot(devh, data, data_len, ep_num, chunk_len);