ideviceimagemounter: Use new idevice_get_device_version and helper macro for version checks
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index 0117d17..90c5190 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -268,23 +268,14 @@
 		goto leave;
 	}
 
-	plist_t pver = NULL;
-	char *product_version = NULL;
-	lockdownd_get_value(lckd, NULL, "ProductVersion", &pver);
-	if (pver && plist_get_node_type(pver) == PLIST_STRING) {
-		plist_get_string_val(pver, &product_version);
-	}
+	unsigned int device_version = idevice_get_device_version(device);
+
 	disk_image_upload_type_t disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_AFC;
-	int product_version_major = 0;
-	int product_version_minor = 0;
-	if (product_version) {
-		if (sscanf(product_version, "%d.%d.%*d", &product_version_major, &product_version_minor) == 2) {
-			if (product_version_major >= 7)
-				disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_UPLOAD_IMAGE;
-		}
+	if (device_version >= IDEVICE_DEVICE_VERSION(7,0,0)) {
+		disk_image_upload_type = DISK_IMAGE_UPLOAD_TYPE_UPLOAD_IMAGE;
 	}
 
-	if (product_version_major >= 16) {
+	if (device_version >= IDEVICE_DEVICE_VERSION(16,0,0)) {
 		uint8_t dev_mode_status = 0;
 		plist_t val = NULL;
 		ldret = lockdownd_get_value(lckd, "com.apple.security.mac.amfi", "DeveloperModeStatus", &val);
@@ -337,7 +328,7 @@
 			goto leave;
 		}
 		image_size = fst.st_size;
-		if (product_version_major < 17 && stat(image_sig_path, &fst) != 0) {
+		if (device_version < IDEVICE_DEVICE_VERSION(17,0,0) && stat(image_sig_path, &fst) != 0) {
 			fprintf(stderr, "ERROR: stat: %s: %s\n", image_sig_path, strerror(errno));
 			goto leave;
 		}
@@ -352,7 +343,7 @@
 	if (cmd == CMD_LIST) {
 		/* list mounts mode */
 		if (!imagetype) {
-			if (product_version_major < 17) {
+			if (device_version < IDEVICE_DEVICE_VERSION(17,0,0)) {
 				imagetype = "Developer";
 			} else {
 				imagetype = "Personalized";
@@ -372,7 +363,7 @@
 		struct stat fst;
 		plist_t mount_options = NULL;
 
-		if (product_version_major < 17) {
+		if (device_version < IDEVICE_DEVICE_VERSION(17,0,0)) {
 			f = fopen(image_sig_path, "rb");
 			if (!f) {
 				fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno));