summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mkii.c4
-rw-r--r--src/mkii.h2
-rw-r--r--src/usb-device.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/src/mkii.c b/src/mkii.c
index 7e307b8..aa02432 100644
--- a/src/mkii.c
+++ b/src/mkii.c
@@ -164,11 +164,11 @@ int mkii_init(struct usb_device_info * dev) {
if ( ret == 0 )
libusb_get_string_descriptor_ascii(dev->udev, desc->iConfiguration, (unsigned char*)buf, sizeof(buf));
if ( strncmp(buf, "Firmware Upgrade Configuration", sizeof("Firmware Upgrade Configuration")) == 0 )
- dev->data |= (1UL << 31);
+ dev->data |= MKII_UPDATE_MODE;
if ( ret == 0 )
libusb_free_config_descriptor(desc);
- printf("Mode: %s\n", (dev->data & (1UL << 31)) ? "Update" : "PC Suite");
+ printf("Mode: %s\n", (dev->data & MKII_UPDATE_MODE) ? "Update" : "PC Suite");
return 0;
diff --git a/src/mkii.h b/src/mkii.h
index d4d5c31..11fbd2a 100644
--- a/src/mkii.h
+++ b/src/mkii.h
@@ -24,6 +24,8 @@
#include "device.h"
#include "usb-device.h"
+#define MKII_UPDATE_MODE (1UL << 31)
+
int mkii_init(struct usb_device_info * dev);
enum device mkii_get_device(struct usb_device_info * dev);
diff --git a/src/usb-device.c b/src/usb-device.c
index e0c4074..895e56f 100644
--- a/src/usb-device.c
+++ b/src/usb-device.c
@@ -377,7 +377,7 @@ void usb_switch_to_update(struct usb_device_info * dev) {
leave_cold_flash(dev);
else if ( dev->flash_device->protocol == FLASH_NOLO )
nolo_boot_device(dev, "update");
- else if ( dev->flash_device->protocol == FLASH_MKII && ! ( dev->data & ( 1UL << 31 ) ) )
+ else if ( dev->flash_device->protocol == FLASH_MKII && ! ( dev->data & MKII_UPDATE_MODE ) )
mkii_reboot_device(dev);
else if ( dev->flash_device->protocol == FLASH_DISK )
printf_and_wait("Unplug USB cable, turn device off, press ENTER and plug USB cable again");
@@ -394,7 +394,7 @@ void usb_switch_to_disk(struct usb_device_info * dev) {
nolo_boot_device(dev, NULL);
printf_and_wait("Wait until device start, choose USB Mass Storage Mode and press ENTER");
} else if ( dev->flash_device->protocol == FLASH_MKII ) {
- if ( dev->data & ( 1UL << 31 ) )
+ if ( dev->data & MKII_UPDATE_MODE )
mkii_reboot_device(dev);
else
printf_and_wait("Unplug USB cable, plug again, choose USB Mass Storage Mode and press ENTER");