summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2018-02-08 19:24:11 +0100
committerPali Rohár <pali.rohar@gmail.com>2018-02-08 19:24:11 +0100
commite685787e67c431579f8e2cf717a19174f154fe6c (patch)
treee47d33e60b83f5fb1bde595714dd5ad1e81cd66f /src
parent10b495120e17bb7aeaf24c76db4d291bedb14dc8 (diff)
download0xFFFF-e685787e67c431579f8e2cf717a19174f154fe6c.tar.bz2
disk: Ensure that maj1:min1 is first device and maj2:min2 is second device
Diffstat (limited to 'src')
-rw-r--r--src/disk.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/disk.c b/src/disk.c
index c8d218c..bb8ae02 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -304,6 +304,7 @@ int disk_init(struct usb_device_info * dev) {
int maj2;
int min1;
int min2;
+ int tmp;
maj1 = -1;
maj2 = -1;
@@ -390,6 +391,16 @@ int disk_init(struct usb_device_info * dev) {
return -1;
}
+ /* Ensure that maj1:min1 is first device and maj2:min2 is second device */
+ if ( min2 < min1 ) {
+ tmp = min1;
+ min1 = min2;
+ min2 = tmp;
+ tmp = maj1;
+ maj1 = maj2;
+ maj2 = tmp;
+ }
+
/* TODO: change 1 to 0 when disk_flash_dev will be implemented */
/* RX-51 and RM-680 export MyDocs in first usb device and just first partion, so host system see whole device without MBR table */