Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 1 | |
| 2 | #include <stdio.h> |
| 3 | #include <string.h> |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | |
| 7 | unsigned char g_sensortype [][2] = { |
| 8 | {0xc7, 58}, |
| 9 | {0x01, 113}, |
| 10 | {0xc7, 56}, |
| 11 | {0x01, 114}, |
| 12 | {0xc6, 54}, |
| 13 | {0x07, 40}, |
| 14 | {0xC1, 121}, |
| 15 | {0xC2, 137}, |
| 16 | {0x07, 36}, |
| 17 | {0x07, 43}, |
| 18 | {0xC1, 122}, |
| 19 | {0xC1, 119}, |
| 20 | {0x01, 12}, |
| 21 | {0x01, 111}, |
| 22 | {0x01, 116}, |
| 23 | {0xC1, 127}, |
| 24 | {0xC2, 134}, |
| 25 | {0xC2, 130}, |
| 26 | {0xc, 33}, |
| 27 | {0xC1, 125}, |
| 28 | {0x01, 115}, |
| 29 | {0x22, 4}, |
| 30 | {0xC2, 138}, |
| 31 | {0x01, 108}, |
| 32 | {0x01, 102}, |
| 33 | {0xc, 46}, |
| 34 | {0x7, 11}, |
| 35 | {0xC1, 120}, |
| 36 | {0x07, 39}, |
| 37 | {0x07, 42}, |
| 38 | {0x5, 21}, |
| 39 | {0xC2, 131}, |
| 40 | {0xc1, 48}, |
| 41 | {0x12, 53}, |
| 42 | {0xC1, 124}, |
| 43 | {0x01, 117}, |
| 44 | {0xC1, 126}, |
| 45 | {0xf, 5}, |
| 46 | {0x23, 0}, |
| 47 | {0xC2, 139}, |
| 48 | {0x07, 34}, |
| 49 | {0x09, 146}, |
| 50 | {0x02, 178}, |
| 51 | {0xC2, 140}, |
| 52 | {0xC1, 118}, |
| 53 | {0xC2, 133}, |
| 54 | {0x07, 38}, |
| 55 | {0xC2, 143}, |
| 56 | {0x01, 101}, |
| 57 | {0xc3, 9}, |
| 58 | {0x7, 10}, |
| 59 | {0xc2, 51}, |
| 60 | {0x01, 109}, |
| 61 | {0xc, 32}, |
| 62 | {0x7, 8}, |
| 63 | {0xC1, 129}, |
| 64 | {0x01, 112}, |
| 65 | {0x01, 107}, |
| 66 | {0x07, 37}, |
| 67 | {0x07, 44}, |
| 68 | {0x1f, 50}, |
| 69 | {0xC2, 144}, |
| 70 | {0xc7, 52}, |
| 71 | {0xC2, 141}, |
| 72 | {0x01, 106}, |
| 73 | {0x01, 110}, |
| 74 | {0x01, 103}, |
| 75 | {0x9, 28}, |
| 76 | {0x07, 35}, |
| 77 | {0xc7, 55}, |
| 78 | {0x03, 179}, |
| 79 | {0x07, 41}, |
| 80 | {0xc, 30}, |
| 81 | {0x01, 100}, |
| 82 | {0xC1, 128}, |
| 83 | {0xC2, 135}, |
| 84 | {0x01, 105}, |
| 85 | {0x7, 47}, |
| 86 | {0xC2, 145}, |
| 87 | {0xc7, 57}, |
| 88 | {0x01, 104}, |
| 89 | {0x07, 45}, |
| 90 | {0xC2, 132}, |
| 91 | {0xc4, 49}, |
| 92 | {0xC1, 123}, |
| 93 | {0xC2, 142}, |
| 94 | {0x01, 13}, |
| 95 | {0xC2, 136}, |
| 96 | {0xc, 31}, |
| 97 | {0xff,0xff} |
| 98 | }; |
| 99 | |
| 100 | unsigned char findSensor(char sensor_number) { |
| 101 | |
| 102 | int i=0; |
| 103 | |
| 104 | // TODO : This function should actually call |
| 105 | // a dbus object and have it return the data |
| 106 | // it is not ready yet so use a Palmetto |
| 107 | // based lookup table for now. The g_sensortype |
| 108 | // can be removed once the dbus method exists |
| 109 | while (g_sensortype[i][0] != 0xff) { |
| 110 | if (g_sensortype[i][1] == sensor_number) { |
| 111 | break; |
| 112 | } else { |
| 113 | i++; |
| 114 | } |
| 115 | |
| 116 | } |
| 117 | |
| 118 | return g_sensortype[i][0]; |
| 119 | |
| 120 | } |
| 121 | |
| 122 | |
Chris Austen | 0130d6e | 2015-10-15 22:32:36 -0500 | [diff] [blame] | 123 | int set_sensor_dbus_state_v(uint8_t number, const char *method, char *value) { |
| 124 | printf("Attempting to log Variant Sensor 0x%02x via %s with a value of %s\n", |
| 125 | number, method, value); |
| 126 | |
| 127 | } |
| 128 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 129 | int set_sensor_dbus_state(uint8_t number, const char *method, const char *value) { |
| 130 | |
| 131 | printf("Attempting to log Sensor 0x%02x via %s with a value of %s\n", |
| 132 | number, method, value); |
| 133 | |
| 134 | return 0; |
| 135 | } |
| 136 | |
| 137 | |
| 138 | extern int updateSensorRecordFromSSRAESC(const void *record); |
| 139 | |
| 140 | |
| 141 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 142 | uint8_t testrec_boot1[] = {0x05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00}; |
| 143 | uint8_t testrec_boot2[] = {0x05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00}; |
| 144 | uint8_t testrec_boot3[] = {0x05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00}; |
| 145 | uint8_t testrec_boot4[] = {0x05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00}; |
| 146 | |
| 147 | |
| 148 | |
| 149 | // DIMM Present |
| 150 | uint8_t testrec_sensor1[] {0x1F, 0xa9, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00}; |
| 151 | |
| 152 | // DIMM Not present |
| 153 | uint8_t testrec_sensor2[] {0x1F, 0xa9, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}; |
| 154 | |
| 155 | |
| 156 | uint8_t testrec_bootprogress[] = {05, 0xa9, 0x00, 0x04, 0x00, 0x00, 0x14, 0x00 }; |
| 157 | |
| 158 | int main() { |
| 159 | |
| 160 | updateSensorRecordFromSSRAESC(testrec_bootprogress); |
| 161 | updateSensorRecordFromSSRAESC(testrec_sensor1); |
| 162 | updateSensorRecordFromSSRAESC(testrec_sensor2); |
| 163 | |
| 164 | |
| 165 | return 0; |
| 166 | } |