summaryrefslogtreecommitdiffstats
path: root/src/usb-device.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-09-23 14:03:28 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-09-23 14:03:28 +0200
commitfc51f45195c240b92d4aa5237da15ff8c57ea6f5 (patch)
treea97bdcbc51889f35b0c267ea069629592cd2c152 /src/usb-device.c
parent26c1c2914ea7836e1a9ad06ef14b51b24556bb4c (diff)
download0xFFFF-fc51f45195c240b92d4aa5237da15ff8c57ea6f5.tar.bz2
usb-device: Added usb_switch_to_ functions
Diffstat (limited to 'src/usb-device.c')
-rw-r--r--src/usb-device.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/usb-device.c b/src/usb-device.c
index 85100f9..855cf35 100644
--- a/src/usb-device.c
+++ b/src/usb-device.c
@@ -30,6 +30,8 @@
#include "device.h"
#include "usb-device.h"
#include "printf-utils.h"
+#include "nolo.h"
+#include "cold-flash.h"
static struct usb_flash_device usb_devices[] = {
{ 0x0421, 0x0105, 2, 1, -1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, 0 } },
@@ -287,3 +289,43 @@ void usb_close_device(struct usb_device_info * dev) {
free(dev);
}
+
+void usb_switch_to_nolo(struct usb_device_info * dev) {
+
+ printf("\nSwitching to NOLO mode...\n");
+
+ if ( dev->flash_device->protocol == FLASH_COLD )
+ leave_cold_flash(dev);
+ else if ( dev->flash_device->protocol == FLASH_MKII )
+ ERROR("Leaving Mk II protocol is not implemented yet");
+ else if ( dev->flash_device->protocol == FLASH_DISK )
+ printf_and_wait("Unplug USB cable, turn device off, press ENTER and plug USB cable again");
+
+}
+
+void usb_switch_to_cold(struct usb_device_info * dev) {
+
+ printf("\nSwitching to Cold Flash mode...\n");
+ printf_and_wait("Unplug USB cable, turn device off, press ENTER and plug USB cable again");
+
+}
+
+void usb_switch_to_mkii(struct usb_device_info * dev) {
+
+ printf("\nSwitching to Update mode...\n");
+
+ if ( dev->flash_device->protocol == FLASH_COLD )
+ leave_cold_flash(dev);
+ else if ( dev->flash_device->protocol == FLASH_NOLO )
+ nolo_boot_device(dev, "update");
+ else if ( dev->flash_device->protocol == FLASH_DISK )
+ printf_and_wait("Unplug USB cable, turn device off, press ENTER and plug USB cable again");
+
+}
+
+void usb_switch_to_disk(struct usb_device_info * dev) {
+
+ printf("\nSwitching to RAW disk mode...\n");
+ ERROR("usb_switch_to_disk is not implemented yet");
+
+}