From 3f225ca3da94432a4a7f3d0bea8563dfffc6f1ea Mon Sep 17 00:00:00 2001
From: Nikias Bassen
Date: Tue, 14 Feb 2012 21:37:22 +0100
Subject: libirecovery: cpid/bdid are actually hex values

---
 src/libirecovery.c |  6 ++--
 src/libirecovery.h | 96 +++++++++++++++++++++++++++---------------------------
 2 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/src/libirecovery.c b/src/libirecovery.c
index c0a20bd..148dced 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -1081,7 +1081,7 @@ irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) {
 	if (client->mode == kWTFMode) {
 		char s_cpid[8] = {0,};
 		strncpy(s_cpid, client->serial, 4);
-		if (sscanf(s_cpid, "%d", cpid) != 1) {
+		if (sscanf(s_cpid, "%x", cpid) != 1) {
 			*cpid = 0;
 			return IRECV_E_UNKNOWN_ERROR;
 		}
@@ -1093,7 +1093,7 @@ irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) {
 		*cpid = 0;
 		return IRECV_E_UNKNOWN_ERROR;
 	}
-	sscanf(cpid_string, "CPID:%d", cpid);
+	sscanf(cpid_string, "CPID:%x", cpid);
 
 	return IRECV_E_SUCCESS;
 }
@@ -1106,7 +1106,7 @@ irecv_error_t irecv_get_bdid(irecv_client_t client, unsigned int* bdid) {
 		*bdid = 0;
 		return IRECV_E_UNKNOWN_ERROR;
 	}
-	sscanf(bdid_string, "BDID:%d", bdid);
+	sscanf(bdid_string, "BDID:%x", bdid);
 
 	return IRECV_E_SUCCESS;
 }
diff --git a/src/libirecovery.h b/src/libirecovery.h
index 84d8681..0118c8b 100644
--- a/src/libirecovery.h
+++ b/src/libirecovery.h
@@ -37,39 +37,39 @@ extern "C" {
 
 #define APPLE_VENDOR_ID 0x05AC
 
-#define CPID_UNKNOWN        -1
-#define CPID_IPHONE2G     8900
-#define CPID_IPOD1G       8900
-#define CPID_IPHONE3G     8900
-#define CPID_IPOD2G       8720
-#define CPID_IPHONE3GS    8920
-#define CPID_IPOD3G       8922
-#define CPID_IPAD1G       8930
-#define CPID_IPHONE4      8930
-#define CPID_IPOD4G       8930
-#define CPID_APPLETV2     8930
-#define CPID_IPHONE42     8930
-#define CPID_IPAD21       8940
-#define CPID_IPAD22       8940
-#define CPID_IPAD23       8940
-#define CPID_IPHONE4S     8940
-
-#define BDID_UNKNOWN        -1
-#define BDID_IPHONE2G        0
-#define BDID_IPOD1G          2
-#define BDID_IPHONE3G        4
-#define BDID_IPOD2G          0
-#define BDID_IPHONE3GS       0
-#define BDID_IPOD3G          2
-#define BDID_IPAD1G          2
-#define BDID_IPHONE4         0
-#define BDID_IPOD4G          8
-#define BDID_APPLETV2       10
-#define BDID_IPHONE42        6
-#define BDID_IPAD21          4
-#define BDID_IPAD22          6
-#define BDID_IPAD23          2
-#define BDID_IPHONE4S        8
+#define CPID_UNKNOWN          -1
+#define CPID_IPHONE2G     0x8900
+#define CPID_IPOD1G       0x8900
+#define CPID_IPHONE3G     0x8900
+#define CPID_IPOD2G       0x8720
+#define CPID_IPHONE3GS    0x8920
+#define CPID_IPOD3G       0x8922
+#define CPID_IPAD1G       0x8930
+#define CPID_IPHONE4      0x8930
+#define CPID_IPOD4G       0x8930
+#define CPID_APPLETV2     0x8930
+#define CPID_IPHONE42     0x8930
+#define CPID_IPAD21       0x8940
+#define CPID_IPAD22       0x8940
+#define CPID_IPAD23       0x8940
+#define CPID_IPHONE4S     0x8940
+
+#define BDID_UNKNOWN          -1
+#define BDID_IPHONE2G       0x00
+#define BDID_IPOD1G         0x02
+#define BDID_IPHONE3G       0x04
+#define BDID_IPOD2G         0x00
+#define BDID_IPHONE3GS      0x00
+#define BDID_IPOD3G         0x02
+#define BDID_IPAD1G         0x02
+#define BDID_IPHONE4        0x00
+#define BDID_IPOD4G         0x08
+#define BDID_APPLETV2       0x10
+#define BDID_IPHONE42       0x06
+#define BDID_IPAD21         0x04
+#define BDID_IPAD22         0x06
+#define BDID_IPAD23         0x02
+#define BDID_IPHONE4S       0x08
 
 #define DEVICE_UNKNOWN      -1
 #define DEVICE_IPHONE2G      0
@@ -169,21 +169,21 @@ struct irecv_device {
 };
 
 static struct irecv_device irecv_devices[] = {
-	{  0, "iPhone1,1",  "m68ap",  0,  8900 },
-	{  1, "iPod1,1",    "n45ap",  2,  8900 },
-	{  2, "iPhone1,2",  "n82ap",  4,  8900 },
-	{  3, "iPod2,1",    "n72ap",  0,  8720 },
-	{  4, "iPhone2,1",  "n88ap",  0,  8920 },
-	{  5, "iPod3,1",    "n18ap",  2,  8922 },
-	{  6, "iPad1,1",    "k48ap",  2,  8930 },
-	{  7, "iPhone3,1",  "n90ap",  0,  8930 },
-	{  8, "iPod4,1",    "n81ap",  8,  8930 },
-	{  9, "AppleTV2,1", "k66ap", 10,  8930 },
-	{ 10, "iPhone3,3",  "n92ap",  6,  8930 },
-	{ 11, "iPad2,1",    "k93ap",  4,  8940 },
-	{ 12, "iPad2,2",    "k94ap",  6,  8940 },
-	{ 13, "iPad2,3",    "k95ap",  2,  8940 },
-	{ 14, "iPhone4,1",  "n94ap",  8,  8940 },
+	{  0, "iPhone1,1",  "m68ap", 0x00, 0x8900 },
+	{  1, "iPod1,1",    "n45ap", 0x02, 0x8900 },
+	{  2, "iPhone1,2",  "n82ap", 0x04, 0x8900 },
+	{  3, "iPod2,1",    "n72ap", 0x00, 0x8720 },
+	{  4, "iPhone2,1",  "n88ap", 0x00, 0x8920 },
+	{  5, "iPod3,1",    "n18ap", 0x02, 0x8922 },
+	{  6, "iPad1,1",    "k48ap", 0x02, 0x8930 },
+	{  7, "iPhone3,1",  "n90ap", 0x00, 0x8930 },
+	{  8, "iPod4,1",    "n81ap", 0x08, 0x8930 },
+	{  9, "AppleTV2,1", "k66ap", 0x10, 0x8930 },
+	{ 10, "iPhone3,3",  "n92ap", 0x06, 0x8930 },
+	{ 11, "iPad2,1",    "k93ap", 0x04, 0x8940 },
+	{ 12, "iPad2,2",    "k94ap", 0x06, 0x8940 },
+	{ 13, "iPad2,3",    "k95ap", 0x02, 0x8940 },
+	{ 14, "iPhone4,1",  "n94ap", 0x08, 0x8940 },
 	{ -1,  NULL,           NULL, -1,    -1 }
 };
 
-- 
cgit v1.1-32-gdbae