}
}
+void print_boarddescription(unsigned char *bd)
+{
+ int j;
+
+ for (j = 0; j < 32; j++) {
+ printf("%02x ", *(bd+j));
+ }
+ printf("\n");
+
+ /* com/agilent/rmc/amr/AmrMaster.class
+ * com/agilent/rmc/mgui/RmcPanel.class
+ * com/agilent/rmc/mgui/panels/AvrManualConfig.class
+ * com/agilent/rmc/mgui/panels/CardConf.jad
+ * com/agilent/rmc/mgui/panels/PowerMgmtConf.jad
+ * com/agilent/rmc/mgui/panels/RemoteDiskConf.jad
+ */
+ printf("\tserial1Present\t\t: %s\n", ((bd[20] & 2) ? "TRUE" : "FALSE"));
+ printf("\ticmbPresent\t\t: %s\n", ((bd[20] & 4) ? "TRUE" : "FALSE"));
+ printf("\tlanPresent\t\t: %s\n", ((bd[20] & 8) ? "TRUE" : "FALSE"));
+ printf("\tserial2Present\t\t: %s\n", ((bd[20] & 0x10) ? "TRUE" : "FALSE"));
+ printf("\tserial3Present\t\t: %s\n", ((bd[20] & 0x20) ? "TRUE" : "FALSE"));
+ printf("\tusbPresent\t\t: %s\n", ((bd[20] & 0x40) ? "TRUE" : "FALSE"));
+ printf("\tpciPresent\t\t: %s\n", ((bd[21] & 3) ? "TRUE" : "FALSE"));
+ printf("\tlpcPresent\t\t: %s\n", ((bd[21] & 4) ? "TRUE" : "FALSE"));
+ printf("\tvgaPresent\t\t: %s\n", ((bd[21] & 8) ? "TRUE" : "FALSE"));
+ printf("\tbatteryPresent\t\t: %s\n", ((bd[21] & 0x10) ? "TRUE" : "FALSE"));
+ printf("\tacdcPresent\t\t: %s\n", ((bd[21] & 0x20) ? "TRUE" : "FALSE"));
+ printf("\tstandbyPresent\t\t: %s\n", ((bd[21] & 0x40) ? "TRUE" : "FALSE"));
+ printf("\thasPowerConnectors\t: %s\n", ((bd[21] & 0x70) ? "TRUE" : "FALSE"));
+ printf("\tdviPresent\t\t: %s\n", ((bd[21] & 0x80) ? "TRUE" : "FALSE"));
+ printf("\tpowerSwitchATX\t\t: %s\n", ((bd[22] & 1) ? "TRUE" : "FALSE"));
+ printf("\tpowerSwitchRelay\t: %s\n", ((bd[22] & 2) ? "TRUE" : "FALSE"));
+ /* 22 & 4 */
+ printf("\tps2aPresent\t\t: %s\n", ((bd[25]) ? "TRUE" : "FALSE"));
+}
+
void handle_boarddescription(unsigned char *fw, int len, int patch)
{
- /* 0x01 0x01 0x50 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x88 0x02 0xac 0x01 0xd0 0x05 0x00 0x00 0x6a 0x3a 0x00 0x00 0x06 0x00 0x01 0x00 0x00 0x00 0x00 0x00 */
+ int i;
+
+ for (i = len - (strlen("pdata")+1); i > 0; i--) {
+ if (FINDSTR(fw+i, "pdata")) {
+ unsigned char *pos = fw + i + strlen("pdata") + 1;
+
+ /* MAGIC? */
+ if (*((unsigned int*)pos) != 0x00002802) {
+ continue;
+ }
+
+ pos += 26;
+
+ /* MAGIC2? */
+ if (*((unsigned int*)pos) != 0x00500101) {
+ continue;
+ }
+
+ if (patch) {
+ /* Enable ATX and relay power switching */
+ pos[22] |= 0x03;
+ }
+ printf("0x%08x: BOARD_DESCRIPTION: ", pos-fw);
+ print_boarddescription(pos);
+
+ break;
+ }
+ }
}
void syntax(char *name)
fprintf(stderr,"parameters as follows:\n");
fprintf(stderr,"\t-d\t\tdisplay all properties of the image\n");
fprintf(stderr,"\t-u\t\tupdate checksum of the image\n");
+ fprintf(stderr,"\t-b\t\tmodify BOARD_DESCRIPTION for more power-switch options\n");
fprintf(stderr,"\t-t property\tset 'property' to true\n");
fprintf(stderr,"\t-f property\tset 'property' to false\n");
fprintf(stderr,"\t-w property\tallow read-write access to 'property'\n");
struct propaction *paction = NULL;
int showall = 0;
int update_crc = 0;
+ int patch_bd = 0;
int patch_fw = 0;
if (argc < 2)
syntax(argv[0]);
- while ((opt = getopt(argc, argv, "dut:f:w:r:")) != -1) {
+ while ((opt = getopt(argc, argv, "dubt:f:w:r:")) != -1) {
switch(opt) {
case 'd':
showall = 1;
case 'u':
update_crc = 1;
break;
+ case 'b':
+ patch_bd = 1;
+ break;
case 't':
case 'f':
case 'w':
printf("\n");
}
- if (showall)
+ if (patch_bd) {
+ handle_boarddescription(fw, statbuf.st_size -4, 1);
+ }
+
+ if (showall) {
show_properties(fw, statbuf.st_size - 4);
+ handle_boarddescription(fw, statbuf.st_size -4, 0);
+ }
- if (update_crc || patch_fw) {
+ if (update_crc || patch_fw || patch_bd) {
ret = rsb_crc2(fw, statbuf.st_size, 0x55335053, &crc);
if (ret == 4) {
*((unsigned int*)(fw + statbuf.st_size - 4)) = crc;