summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/lib/hwstub.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-07-16 19:29:42 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-07-16 19:29:42 +0200
commite5de5e09c1ca6788d155393af0d906a9402ea7bc (patch)
tree14aa5a0d78ae96d233bdffe96e3207ba27a4631e /utils/hwstub/lib/hwstub.c
parent5ba7e2ca72412a4e58a76f43738f6309b533e03f (diff)
downloadrockbox-e5de5e09c1ca6788d155393af0d906a9402ea7bc.tar.gz
rockbox-e5de5e09c1ca6788d155393af0d906a9402ea7bc.zip
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
Diffstat (limited to 'utils/hwstub/lib/hwstub.c')
-rw-r--r--utils/hwstub/lib/hwstub.c21
1 files changed, 11 insertions, 10 deletions
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;
}