665:66fae54fa7ba | 666:48cc8868f9f4 |
---|---|
169 | 169 |
170 for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) | 170 for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) |
171 *c = 0 ; | 171 *c = 0 ; |
172 | 172 |
173 if (debug) | 173 if (debug) |
174 fprintf(stdout, "piBoardId: Revision string: %s\n", line) ; | 174 syslog(LOG_NOTICE, "piBoardId: Revision string: %s", line) ; |
175 | 175 |
176 // Need to work out if it's using the new or old encoding scheme: | 176 // Need to work out if it's using the new or old encoding scheme: |
177 | 177 |
178 // Scan to the first character of the revision number | 178 // Scan to the first character of the revision number |
179 | 179 |
199 | 199 |
200 // Check for new way: | 200 // Check for new way: |
201 | 201 |
202 if ((revision & (1 << 23)) != 0) { // New way | 202 if ((revision & (1 << 23)) != 0) { // New way |
203 if (debug) | 203 if (debug) |
204 fprintf(stdout, "piBoardId: New Way: revision is: %08X\n", revision) ; | 204 syslog(LOG_NOTICE, "piBoardId: New Way: revision is: %08X", revision) ; |
205 | 205 |
206 bRev = (revision & (0x0F << 0)) >> 0 ; | 206 bRev = (revision & (0x0F << 0)) >> 0 ; |
207 bType = (revision & (0xFF << 4)) >> 4 ; | 207 bType = (revision & (0xFF << 4)) >> 4 ; |
208 bProc = (revision & (0x0F << 12)) >> 12 ; // Not used for now. | 208 bProc = (revision & (0x0F << 12)) >> 12 ; // Not used for now. |
209 bMfg = (revision & (0x0F << 16)) >> 16 ; | 209 bMfg = (revision & (0x0F << 16)) >> 16 ; |
215 *mem = bMem ; | 215 *mem = bMem ; |
216 *maker = bMfg ; | 216 *maker = bMfg ; |
217 *warranty = bWarranty ; | 217 *warranty = bWarranty ; |
218 | 218 |
219 if (debug) | 219 if (debug) |
220 fprintf(stdout, "piBoardId: rev: %d, type: %d, proc: %d, mfg: %d, mem: %d, warranty: %d\n", bRev, bType, bProc, bMfg, bMem, bWarranty) ; | 220 syslog(LOG_NOTICE, "piBoardId: rev: %d, type: %d, proc: %d, mfg: %d, mem: %d, warranty: %d", bRev, bType, bProc, bMfg, bMem, bWarranty) ; |
221 } else { // Old way | 221 } else { // Old way |
222 if (debug) | 222 if (debug) |
223 fprintf(stdout, "piBoardId: Old Way: revision is: %s\n", c) ; | 223 syslog(LOG_NOTICE, "piBoardId: Old Way: revision is: %s", c) ; |
224 | 224 |
225 if (!isdigit (*c)) { | 225 if (!isdigit (*c)) { |
226 syslog(LOG_NOTICE, "Bogus \"Revision\" line (no digit at start of revision)") ; | 226 syslog(LOG_NOTICE, "Bogus \"Revision\" line (no digit at start of revision)") ; |
227 return; | 227 return; |
228 } | 228 } |
372 | 372 |
373 | 373 |
374 void my_log_callback(struct mosquitto *my_mosq, void *obj, int level, const char *str) | 374 void my_log_callback(struct mosquitto *my_mosq, void *obj, int level, const char *str) |
375 { | 375 { |
376 // if (debug) | 376 // if (debug) |
377 // fprintf(stdout, "MQTT: %s\n", str); | 377 // syslog(LOG_NOTICE, "MQTT: %s", str); |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 | 381 |
382 void my_message_callback(struct mosquitto *my_mosq, void *userdata, const struct mosquitto_message *message) | 382 void my_message_callback(struct mosquitto *my_mosq, void *userdata, const struct mosquitto_message *message) |