From e685787e67c431579f8e2cf717a19174f154fe6c Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Thu, 8 Feb 2018 19:24:11 +0100 Subject: disk: Ensure that maj1:min1 is first device and maj2:min2 is second device --- src/disk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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 */ -- cgit v1.2.3