diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/ttpci-eeprom.c')
-rw-r--r-- | drivers/media/dvb/ttpci/ttpci-eeprom.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.c b/drivers/media/dvb/ttpci/ttpci-eeprom.c index ac79ef178c05..18aa22b5478d 100644 --- a/drivers/media/dvb/ttpci/ttpci-eeprom.c +++ b/drivers/media/dvb/ttpci/ttpci-eeprom.c | |||
@@ -13,7 +13,7 @@ | |||
13 | Holger Waechtler Convergence | 13 | Holger Waechtler Convergence |
14 | 14 | ||
15 | Copyright (C) 2002-2003 Ralph Metzler <rjkm@metzlerbros.de> | 15 | Copyright (C) 2002-2003 Ralph Metzler <rjkm@metzlerbros.de> |
16 | Metzler Brothers Systementwicklung GbR | 16 | Metzler Brothers Systementwicklung GbR |
17 | 17 | ||
18 | This program is free software; you can redistribute it and/or modify | 18 | This program is free software; you can redistribute it and/or modify |
19 | it under the terms of the GNU General Public License as published by | 19 | it under the terms of the GNU General Public License as published by |
@@ -48,41 +48,41 @@ | |||
48 | 48 | ||
49 | static int check_mac_tt(u8 *buf) | 49 | static int check_mac_tt(u8 *buf) |
50 | { | 50 | { |
51 | int i; | 51 | int i; |
52 | u16 tmp = 0xffff; | 52 | u16 tmp = 0xffff; |
53 | 53 | ||
54 | for (i = 0; i < 8; i++) { | 54 | for (i = 0; i < 8; i++) { |
55 | tmp = (tmp << 8) | ((tmp >> 8) ^ buf[i]); | 55 | tmp = (tmp << 8) | ((tmp >> 8) ^ buf[i]); |
56 | tmp ^= (tmp >> 4) & 0x0f; | 56 | tmp ^= (tmp >> 4) & 0x0f; |
57 | tmp ^= (tmp << 12) ^ ((tmp & 0xff) << 5); | 57 | tmp ^= (tmp << 12) ^ ((tmp & 0xff) << 5); |
58 | } | 58 | } |
59 | tmp ^= 0xffff; | 59 | tmp ^= 0xffff; |
60 | return (((tmp >> 8) ^ buf[8]) | ((tmp & 0xff) ^ buf[9])); | 60 | return (((tmp >> 8) ^ buf[8]) | ((tmp & 0xff) ^ buf[9])); |
61 | } | 61 | } |
62 | 62 | ||
63 | static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC) | 63 | static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC) |
64 | { | 64 | { |
65 | u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c, | 65 | u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c, |
66 | 0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6, | 66 | 0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6, |
67 | 0x1d, 0x36, 0x64, 0x78}; | 67 | 0x1d, 0x36, 0x64, 0x78}; |
68 | u8 data[20]; | 68 | u8 data[20]; |
69 | int i; | 69 | int i; |
70 | 70 | ||
71 | /* In case there is a sig check failure have the orig contents available */ | 71 | /* In case there is a sig check failure have the orig contents available */ |
72 | memcpy(data, encodedMAC, 20); | 72 | memcpy(data, encodedMAC, 20); |
73 | 73 | ||
74 | for (i = 0; i < 20; i++) | 74 | for (i = 0; i < 20; i++) |
75 | data[i] ^= xor[i]; | 75 | data[i] ^= xor[i]; |
76 | for (i = 0; i < 10; i++) | 76 | for (i = 0; i < 10; i++) |
77 | data[i] = ((data[2 * i + 1] << 8) | data[2 * i]) | 77 | data[i] = ((data[2 * i + 1] << 8) | data[2 * i]) |
78 | >> ((data[2 * i + 1] >> 6) & 3); | 78 | >> ((data[2 * i + 1] >> 6) & 3); |
79 | 79 | ||
80 | if (check_mac_tt(data)) | 80 | if (check_mac_tt(data)) |
81 | return -ENODEV; | 81 | return -ENODEV; |
82 | 82 | ||
83 | decodedMAC[0] = data[2]; decodedMAC[1] = data[1]; decodedMAC[2] = data[0]; | 83 | decodedMAC[0] = data[2]; decodedMAC[1] = data[1]; decodedMAC[2] = data[0]; |
84 | decodedMAC[3] = data[6]; decodedMAC[4] = data[5]; decodedMAC[5] = data[4]; | 84 | decodedMAC[3] = data[6]; decodedMAC[4] = data[5]; decodedMAC[5] = data[4]; |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC) | 88 | static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC) |