Chameleon

Chameleon Commit Details

Date:2014-01-05 12:47:08 (5 years 6 months ago)
Author:ErmaC
Commit:2288
Parents: 2287
Message:update Chameleon.xcodeproj "hide" SN in bdmesg also for sn assettag
Changes:
M/trunk/i386/libsaio/smbios.h
M/trunk/Chameleon.xcodeproj/project.pbxproj
M/trunk/i386/libsaio/aml_generator.h
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/libsaio/aml_generator.c
M/trunk/i386/libsaio/smbios_decode.c

File differences

trunk/Chameleon.xcodeproj/project.pbxproj
9797
9898
9999
100
101100
102
103101
104102
105103
......
34193417
34203418
34213419
3422
34233420
3424
34253421
34263422
34273423
360A04BC1861F48F0091F464 /* smbios_getters.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios_getters.c; sourceTree = "<group>"; };
360A04BD1861F48F0091F464 /* smbios_getters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios_getters.h; sourceTree = "<group>"; };
360A04BE1861F48F0091F464 /* smbios.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = smbios.c; sourceTree = "<group>"; };
360A04BF1861F48F0091F464 /* smbios.c.diff */ = {isa = PBXFileReference; lastKnownFileType = text; path = smbios.c.diff; sourceTree = "<group>"; };
360A04C01861F48F0091F464 /* smbios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = smbios.h; sourceTree = "<group>"; };
360A04C11861F48F0091F464 /* smbios.h.diff */ = {isa = PBXFileReference; lastKnownFileType = text; path = smbios.h.diff; sourceTree = "<group>"; };
360A04C21861F48F0091F464 /* spd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = "<group>"; };
360A04C31861F48F0091F464 /* spd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = "<group>"; };
360A04C41861F48F0091F464 /* stringTable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = "<group>"; };
360A04BC1861F48F0091F464 /* smbios_getters.c */,
360A04BD1861F48F0091F464 /* smbios_getters.h */,
360A04BE1861F48F0091F464 /* smbios.c */,
360A04BF1861F48F0091F464 /* smbios.c.diff */,
360A04C01861F48F0091F464 /* smbios.h */,
360A04C11861F48F0091F464 /* smbios.h.diff */,
360A04C21861F48F0091F464 /* spd.c */,
360A04C31861F48F0091F464 /* spd.h */,
360A04C41861F48F0091F464 /* stringTable.c */,
trunk/i386/libsaio/aml_generator.c
2121
2222
2323
24
24
2525
2626
2727
2828
29
29
3030
3131
3232
......
7878
7979
8080
81
81
8282
8383
8484
......
183183
184184
185185
186
186
187187
188
188
189189
190
190
191191
192192
193193
......
195195
196196
197197
198
198
199199
200200
201201
......
234234
235235
236236
237
237
238238
239239
240240
......
248248
249249
250250
251
251
252252
253253
254
254
255255
256256
257257
258258
259259
260260
261
261
262262
263263
264264
265
265
266266
267267
268268
......
273273
274274
275275
276
276
277277
278278
279279
280
280
281281
282282
283283
284284
285285
286
286
287287
288288
289289
......
304304
305305
306306
307
307
308308
309309
310310
......
312312
313313
314314
315
315
316316
317
317
318318
319319
320320
......
353353
354354
355355
356
356
357357
358358
359
359
360360
361361
362362
363363
364364
365365
366
366
367367
368368
369369
......
371371
372372
373373
374
374
375375
376376
377377
......
381381
382382
383383
384
384
385385
386386
387387
......
395395
396396
397397
398
398
399399
400400
401401
......
405405
406406
407407
408
408
409409
410410
411411
......
426426
427427
428428
429
429
430430
431431
432432
433433
434434
435435
436
436
437437
438438
439439
......
442442
443443
444444
445
445
446446
447447
448448
......
455455
456456
457457
458
458
459459
460460
461461
......
467467
468468
469469
470
470
471471
472472
473473
......
476476
477477
478478
479
479
480480
481481
482482
483483
484484
485
485
486486
487487
488488
case AML_CHUNK_DWORD:
case AML_CHUNK_QWORD:
case AML_CHUNK_ALIAS:
verbose("aml_add_to_parent: node doesn't support child nodes!\n");
verbose("aml_add_to_parent: Node doesn't support child nodes!\n");
return false;
case AML_CHUNK_NAME:
if (parent->First)
{
verbose("aml_add_to_parent: name node supports only one child node!\n");
verbose("aml_add_to_parent: Name node supports only one child node!\n");
return false;
}
break;
// Free node
if (node->Buffer)
free(node->Buffer);
free(node);
}
unsigned int aml_fill_name(struct aml_chunk* node, const char* name)
{
if (!node)
if (!node)
return 0;
int len = strlen(name), offset = 0, count = len / 4;
if ((len % 4) > 1 || count == 0)
{
verbose("aml_fill_name: pathname %s has incorrect length! Must be 4, 8, 12, 16, etc...\n", name);
}
unsigned int root = 0;
if ((len % 4) == 1 && name[0] == '\\')
root++;
if (node)
{
node->Type = AML_CHUNK_SCOPE;
aml_fill_name(node, name);
}
if (node)
{
node->Type = AML_CHUNK_NAME;
aml_fill_name(node, name);
}
return node;
}
struct aml_chunk* aml_add_package(struct aml_chunk* parent)
{
struct aml_chunk* node = aml_create_node(parent);
if (node)
{
node->Type = AML_CHUNK_PACKAGE;
node->Length = 1;
node->Buffer = malloc(node->Length);
}
struct aml_chunk* aml_add_alias(struct aml_chunk* parent, const char* name1, const char* name2)
{
struct aml_chunk* node = aml_create_node(parent);
if (node)
{
node->Type = AML_CHUNK_ALIAS;
node->Length = 8;
node->Buffer = malloc(node->Length);
aml_fill_simple_name(node->Buffer, name1);
aml_fill_simple_name(node->Buffer+4, name2);
}
return node;
}
if (node)
{
node->Size = 0;
// Calculate child nodes size
struct aml_chunk* child = node->First;
unsigned char child_count = 0;
while (child)
{
child_count++;
node->Size += aml_calculate_size(child);
child = child->Next;
}
node->Size += 1 + node->Length;
break;
}
return node->Size;
}
return 0;
}
unsigned int aml_write_byte(unsigned char value, char* buffer, unsigned int offset)
{
buffer[offset++] = value;
return offset;
}
{
buffer[offset++] = value & 0xff;
buffer[offset++] = value >> 8;
return offset;
}
buffer[offset++] = (value >> 8) & 0xff;
buffer[offset++] = (value >> 16) & 0xff;
buffer[offset++] = (value >> 24) & 0xff;
return offset;
}
buffer[offset++] = (value >> 40) & 0xff;
buffer[offset++] = (value >> 48) & 0xff;
buffer[offset++] = (value >> 56) & 0xff;
return offset;
}
{
memcpy(buffer + offset, value, size);
}
return offset + size;
}
buffer[offset++] = (size >> 4) & 0xff;
buffer[offset++] = (size >> 12) & 0xff;
}
else
else
{
buffer[offset++] = 0xc0 | (size & 0xf);
buffer[offset++] = (size >> 4) & 0xff;
buffer[offset++] = (size >> 12) & 0xff;
buffer[offset++] = (size >> 20) & 0xff;
}
return offset;
}
if (node && buffer)
{
unsigned int old = offset;
switch (node->Type)
{
case AML_CHUNK_NONE:
offset = aml_write_size(node->Size-1, buffer, offset);
offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset);
break;
case AML_CHUNK_BYTE:
if (node->Buffer[0] == 0x0 || node->Buffer[0] == 0x1)
{
offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset);
}
break;
case AML_CHUNK_WORD:
case AML_CHUNK_DWORD:
case AML_CHUNK_QWORD:
offset = aml_write_byte(node->Type, buffer, offset);
offset = aml_write_buffer(node->Buffer, node->Length, buffer, offset);
break;
default:
break;
}
struct aml_chunk* child = node->First;
while (child)
{
offset = aml_write_node(child, buffer, offset);
trunk/i386/libsaio/aml_generator.h
2929
3030
3131
32
33
32
33
3434
35
35
3636
3737
3838
......
5858
5959
6060
61
61
{
unsigned charType;
unsigned intLength;
char*Buffer;
char*Buffer;
unsigned intSize;
struct aml_chunk*Next;
struct aml_chunk*First;
struct aml_chunk*Last;
unsigned int aml_calculate_size(struct aml_chunk* node);
unsigned int aml_write_node(struct aml_chunk* node, char* buffer, unsigned int offset);
#endif /* !__LIBSAIO_AML_GENERATOR_H */
#endif /* !__LIBSAIO_AML_GENERATOR_H */
trunk/i386/libsaio/smbios.c
139139
140140
141141
142
142
143143
144144
145145
146
147
148
146149
147
150
151
152
153
154
155
156
157
148158
149159
150160
151
152
161
162
163
164
165
166
153167
154168
155169
170
171
172
173
174
156175
157
176
158177
159178
160179
161
180
181
162182
163183
184
185
164186
165187
166188
167189
168
190
169191
170192
171193
172194
173195
174
196
175197
176198
177199
178200
201
202
179203
180204
181205
......
309333
310334
311335
312
336
313337
314338
315339
#define KDefaultBoardAssetTagNumber"Pro-Enclosure" // ErmaC
#define kDefaultLocatioInChassis"Part Component" // ErmaC
// defaults for a Mac mini
//=========== Mac mini ===========
#define kDefaultMacminiFamily"Macmini"
#define kDefaultMacmini"Macmini1,1"
#define kDefaultMacminiBIOSVersion" MM21.88Z.009A.B00.0903051113"
// MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309
// MacMini5,2 Mac-4BC72D62AD45599E
// MacMini5,3
// defaults for a MacBook
// MacMini 6,1 - Mac-F65AE981FFA204ED
// MacMini 6,2
//#define kDefaultMacmini62"Macmini6,2"
//#define kDefaultMacmini62BIOSVersion" MM61.88Z.0106.B00.1208091121"
//#define kDefaultMacmini62BoardProduct"Mac-F65AE981FFA204ED"
//#define kDefaultMacmini62BIOSReleaseDate"10/14/2012"
//=========== MacBook ===========
#define kDefaultMacBookFamily"MacBook"
#define kDefaultMacBook"MacBook4,1"
#define kDefaultMacBookBIOSVersion" MB41.88Z.0073.B00.0903051113"
// defaults for a MacBook Pro
//=========== MacBookAir ===========
// MacBookAir4,1 - Mac-C08A6BB70A942AC2
// MacBookAir4,2 - Mac-742912EFDBEE19B3
// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229
// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442
//=========== MacBookPro ===========
#define kDefaultMacBookProFamily"MacBookPro"
#define kDefaultMacBookPro"MacBookPro4,1"
#define kDefaultMacBookProBIOSVersion" MBP41.88Z.0073.B00.0903051113"
// MacBookPro8,1 - Mac-94245B3640C91C81 - MBP81.88Z.0047.B24.1110141131
// MacBookPro8,2 - Mac_94245A3940C91C80
// MacBookPro8,3 - Mac-942459F5819B171B
// MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B02.1310181745
// MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745
// defaults for an iMac
//=========== iMac ===========
#define kDefaultiMacFamily"iMac"
#define kDefaultiMac"iMac8,1"
#define kDefaultiMacBIOSVersion" IM81.88Z.00C1.B00.0903051113"
// defaults for an iMac11,1 core i3/i5/i7
// iMac10,1
// iMac11,1 core i3/i5/i7
#define kDefaultiMacNehalem"iMac11,1"
#define kDefaultiMacNehalemBIOSVersion" IM111.88Z.0034.B00.0903051113"
// iMac11,2
// iMac11,3
// defaults for an iMac12,1
#define kDefaultiMacSandy"iMac12,1"
#define kDefaultiMacSandyBIOSVersion" IM121.88Z.0047.B00.1102091756"
// defaults for a Mac Pro
//=========== MacPro ===========
#define kDefaultMacProFamily"MacPro"
#define kDefaultMacPro"MacPro3,1"
#define kDefaultMacProBIOSVersion" MP31.88Z.006C.B05.0903051113"
// defaults for a Mac Pro 4,1 core i7/Xeon
#define kDefaultMacProNehalem"MacPro4,1"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B04.0903051113"
#define kDefaultMacProNehalemBIOSVersion" MP41.88Z.0081.B08.1001221313"
// defaults for a Mac Pro 5,1 core i7/Xeon
#define kDefaultMacProWestmere"MacPro5,1"
#define kDefaultMacProWestmereBIOSVersion" MP51.88Z.007F.B03.1010071432"
#define kDefaultMacProWestmereBIOSReleaseDate"10/07/2010"
// defaults for a Mac Pro 6,1
// MacPro6,1 - Mac-F60DEB81FF30ACF6 - MP61.88Z.0116.B00.1311020956
//-------------------------------------------------------------------------------------------------------------------------
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component
{kSMBTypeBaseBoard,kSMBByte,getFieldOffset(SMBBaseBoard, boardType),
{kSMBTypeBaseBoard,kSMBByte, getFieldOffset(SMBBaseBoard, boardType),
kSMBBaseBoardTypeKey,NULL, &defaultBaseBoard.boardType }, // SMboardtype - 10 (Motherboard) all model, 11 (Processor+Memory Module) MacPro
//
trunk/i386/libsaio/smbios_decode.c
134134
135135
136136
137
137
138138
139139
140140
DBG("\tManufacturer: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer));
DBG("\tType: %d\n", structHeader->type);
DBG("\tVersion: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->version));
DBG("\tSerial Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tSerial Number: ** PRIVATE **\n"); //%s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber));
DBG("\tAsset Tag Number: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTagNumber));
// Boot-up State:
// Power Supply State
trunk/i386/libsaio/smbios.h
227227
228228
229229
230
231230
232231
233232
/* =======================
System Enclosure (Type 3)
========================= */
typedef struct SMBSystemEnclosure
{
SMB_STRUCT_HEADER // Type 3

Archive Download the corresponding diff file

Revision: 2288