|
@@ -30,6 +30,7 @@
|
|
|
int page(struct http_request *);
|
|
|
int handle_time(struct http_request *);
|
|
|
int handle_wkalrm(struct http_request *);
|
|
|
+int detect_device(struct http_request *);
|
|
|
|
|
|
int
|
|
|
page(struct http_request *req)
|
|
@@ -248,3 +249,17 @@ int handle_wkalrm(struct http_request *req) {
|
|
|
return (KORE_RESULT_OK);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+int detect_device(struct http_request *req) {
|
|
|
+ if(req->method == HTTP_METHOD_GET) {
|
|
|
+ if (access("/sys/bus/nvmem/devices/ds1307_nvram0/nvmem", F_OK) != -1) {
|
|
|
+ http_response(req, 200, "DS1307", 6);
|
|
|
+ } else {
|
|
|
+ http_response(req, 200, "DS1337", 6);
|
|
|
+ }
|
|
|
+ return KORE_RESULT_OK;
|
|
|
+ } else {
|
|
|
+ http_response(req, HTTP_STATUS_METHOD_NOT_ALLOWED, NULL, 0);
|
|
|
+ return (KORE_RESULT_OK);
|
|
|
+ }
|
|
|
+}
|