Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/77195?usp=email )
Change subject: Add send_cmd_raw() ......................................................................
Add send_cmd_raw()
Future versions of EM100 will use different size commands for new features. Add send_cmd_raw() to allow for this.
Change-Id: Ia33735a342fe43350d06ed6951a30fa8b2ef4a67 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M em100.h M usb.c 2 files changed, 9 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/95/77195/1
diff --git a/em100.h b/em100.h index 4ba78a9..5a762cc 100644 --- a/em100.h +++ b/em100.h @@ -47,6 +47,7 @@ #define BULK_SEND_TIMEOUT 5000 /* sentinel value */
/* usb.c */ +int send_cmd_raw(libusb_device_handle *dev, void *data, int length); int send_cmd(libusb_device_handle *dev, void *data); int get_response(libusb_device_handle *dev, void *data, int length);
diff --git a/usb.c b/usb.c index 4fd3df5..b6938ac 100644 --- a/usb.c +++ b/usb.c @@ -16,10 +16,10 @@
/* USB communication */
-int send_cmd(libusb_device_handle *dev, void *data) + +int send_cmd_raw(libusb_device_handle *dev, void *data, int length) { int actual; - int length = 16; /* haven't seen any other length yet */ int ret = libusb_bulk_transfer(dev, 1 | LIBUSB_ENDPOINT_OUT, data, length, &actual, BULK_SEND_TIMEOUT); if (LIBUSB_SUCCESS != ret) @@ -27,6 +27,12 @@ return (actual == length); }
+int send_cmd(libusb_device_handle *dev, void *data) +{ + int length = 16; /* most commands use the same length */ + return send_cmd_raw(dev, data, length); +} + int get_response(libusb_device_handle *dev, void *data, int length) { int actual;