From e5de5e09c1ca6788d155393af0d906a9402ea7bc Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Tue, 16 Jul 2013 19:29:42 +0200 Subject: hwstub: enhance exit protocol and implement on stmp Rename STOP command to EXIT, introduce ATEXIT, this gives better control over the exit of the stub. Add stmp implementation. Change-Id: I45442c8b88b9330d12ef439417ca5ffa1520477a --- utils/hwstub/lib/hwstub.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'utils/hwstub/lib/hwstub.c') diff --git a/utils/hwstub/lib/hwstub.c b/utils/hwstub/lib/hwstub.c index 92010e710b..41842fb181 100644 --- a/utils/hwstub/lib/hwstub.c +++ b/utils/hwstub/lib/hwstub.c @@ -158,17 +158,18 @@ const char *hwstub_get_rev_string(struct usb_resp_info_stmp_t *stmp) } } -int hwstub_aes_otp(struct hwstub_device_t *dev, void *buf, size_t sz, uint16_t param) +int hwstub_atexit(struct hwstub_device_t *dev, int method) { - int ret = libusb_control_transfer(dev->handle, + return libusb_control_transfer(dev->handle, + LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE | + LIBUSB_ENDPOINT_OUT, HWSTUB_ATEXIT, 0, method, NULL, 0, + 1000); +} + +int hwstub_exit(struct hwstub_device_t *dev) +{ + return libusb_control_transfer(dev->handle, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE | - LIBUSB_ENDPOINT_OUT, HWSTUB_AES_OTP, param, 0, buf, sz, + LIBUSB_ENDPOINT_OUT, HWSTUB_EXIT, 0, 0, NULL, 0, 1000); - if(ret <0 || (unsigned)ret != sz) - return -1; - int xfer; - ret = libusb_interrupt_transfer(dev->handle, dev->int_in, buf, sz, &xfer, 1000); - if(ret < 0 || (unsigned)xfer != sz) - return -1; - return ret; } -- cgit v1.2.3