summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/lib
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hwstub/lib')
-rw-r--r--utils/hwstub/lib/hwstub.c21
-rw-r--r--utils/hwstub/lib/hwstub.h5
2 files changed, 14 insertions, 12 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;
}
diff --git a/utils/hwstub/lib/hwstub.h b/utils/hwstub/lib/hwstub.h
index ed058dfa3b..f89bce5de9 100644
--- a/utils/hwstub/lib/hwstub.h
+++ b/utils/hwstub/lib/hwstub.h
@@ -57,8 +57,9 @@ int hwstub_rw_mem(struct hwstub_device_t *dev, int read, uint32_t addr, void *bu
/* Returns <0 on error */
int hwstub_call(struct hwstub_device_t *dev, uint32_t addr);
int hwstub_jump(struct hwstub_device_t *dev, uint32_t addr);
-/* Returns <0 on error. The size must be a multiple of 16. */
-int hwstub_aes_otp(struct hwstub_device_t *dev, void *buf, size_t sz, uint16_t param);
+/* Returns <0 on error */
+int hwstub_atexit(struct hwstub_device_t *dev, int action);
+int hwstub_exit(struct hwstub_device_t *dev);
const char *hwstub_get_product_string(struct usb_resp_info_stmp_t *stmp);
const char *hwstub_get_rev_string(struct usb_resp_info_stmp_t *stmp);