[Debian-iot-packaging] [openzwave-controlpanel] 04/81: Support USB HID controllers and add short data type output.
Dara Adib
daradib-guest at moszumanska.debian.org
Thu Dec 22 16:57:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
daradib-guest pushed a commit to branch debian/master
in repository openzwave-controlpanel.
commit 9075a383cdc8d812a3b562e578d86e79f1bd3757
Author: glsatz at gmail.com <glsatz at gmail.com>
Date: Thu May 12 06:02:53 2011 +0000
Support USB HID controllers and add short data type output.
---
Makefile | 10 ++++++----
cp.js | 9 +++++----
webserver.cpp | 12 +++++++-----
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index 7bddc76..75dde3f 100644
--- a/Makefile
+++ b/Makefile
@@ -25,13 +25,15 @@ INCLUDES := -I ../open-zwave/cpp/src -I ../open-zwave/cpp/src/command_classes/ \
-I ../open-zwave/cpp/src/value_classes/ -I ../open-zwave/cpp/src/platform/ \
-I ../open-zwave/cpp/src/platform/unix -I ../open-zwave/cpp/tinyxml/ \
-I ../libmicrohttpd/src/include
-LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/linux/*.a)
-LIBUSB := -ludev
+# Remove comment below for gnutls support
+GNUTLS := #-lgnutls
+#LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/linux/*.a)
+#LIBUSB := -ludev
# Remove comment below for gnutls support
GNUTLS := #-lgnutls
# for Mac OS X comment out above 2 lines and uncomment next 2 lines
-# LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/mac/*.a)
-# LIBUSB := -framework IOKit -framework CoreFoundation
+#LIBZWAVE := $(wildcard ../open-zwave/cpp/lib/mac/*.a)
+#LIBUSB := -framework IOKit -framework CoreFoundation
LIBS := $(LIBZWAVE) $(GNUTLS) ../libmicrohttpd/src/daemon/.libs/libmicrohttpd.a -pthread $(LIBUSB)
%.o : %.cpp
diff --git a/cp.js b/cp.js
index 5996694..b31b4b9 100644
--- a/cp.js
+++ b/cp.js
@@ -170,7 +170,7 @@ function Poll()
function BED()
{
var forms = document.forms;
- var off = (dev.length == 0) && (usb == 0);
+ var off = (dev.length == 0) && !usb;
for (var i = 0; i < forms.length; i++) {
if (forms[i].name == '')
@@ -192,7 +192,6 @@ function BED()
document.AdmPost.adminops.disabled = off;
document.NodePost.nodeops.selectedIndex = 0;
document.NodePost.nodeops.disabled = off;
- document.DevPost.usbb.disabled = true; // until usb is fixed
if (off) {
document.getElementById('configcur').innerHTML = '';
document.getElementById('configcon').innerHTML = '';
@@ -270,8 +269,8 @@ function DoDevUSB()
}
function DoDevPost(fun)
{
- if (document.DevPost.devname.value.length > 0 || document.DevPost.usbb.value) {
- document.DevPost.action='/devpost.html?dev='+document.DevPost.devname.value+'&fn='+fun+'&usb='+document.DevPost.usbb.value;
+ if (document.DevPost.devname.value.length > 0 || document.DevPost.usbb.checked) {
+ document.DevPost.action='/devpost.html?dev='+document.DevPost.devname.value+'&fn='+fun+'&usb='+document.DevPost.usbb.checked;
document.DevPost.submit();
return true;
} else
@@ -598,6 +597,8 @@ function CreateDivs(elem,genre,divto,node)
divto[node]=divto[node]+CreateTextBox(where[0].childNodes[i].getAttribute('label'),where[0].childNodes[i].firstChild.nodeValue,where[0].childNodes[i].getAttribute('units'),id,ro);
} else if (tag == 'int') {
divto[node]=divto[node]+CreateTextBox(where[0].childNodes[i].getAttribute('label'),where[0].childNodes[i].firstChild.nodeValue,where[0].childNodes[i].getAttribute('units'),id,ro);
+ } else if (tag == 'short') {
+ divto[node]=divto[node]+CreateTextBox(where[0].childNodes[i].getAttribute('label'),where[0].childNodes[i].firstChild.nodeValue,where[0].childNodes[i].getAttribute('units'),id,ro);
} else if (tag == 'list') {
divto[node]=divto[node]+CreateList(where[0].childNodes[i].getAttribute('label'),where[0].childNodes[i].getAttribute('current'),where[0].childNodes[i].getAttribute('units'),id,where[0].childNodes[i].getElementsByTagName('item'),ro);
} else if (tag == 'string') {
diff --git a/webserver.cpp b/webserver.cpp
index a4c8d44..d2aa3f4 100644
--- a/webserver.cpp
+++ b/webserver.cpp
@@ -65,7 +65,7 @@ using namespace OpenZWave;
#define FNF "<html><head><title>File not found</title></head><body>File not found: %s</body></html>"
#define UNKNOWN "<html><head><title>Nothingness</title></head><body>There is nothing here. Sorry.</body></html>\n"
#define DEFAULT "<script type=\"text/javascript\"> document.location.href='/';</script>"
-#define DEVJS "var dev = '%s'; var usb = %d;\n"
+#define DEVJS "var dev = '%s'; var usb = %s;\n"
typedef struct _conninfo {
conntype_t conn_type;
@@ -532,9 +532,9 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
fprintf(stderr, "Out of memory dev.js\n");
exit(1);
}
- snprintf(s, len, DEVJS, devname ? devname : "", usb);
+ snprintf(s, len, DEVJS, devname ? devname : "", usb ? "true" : "false");
ret = web_send_data(conn, s, MHD_HTTP_OK, true, false, "text/javascript"); // free but no copy
- } else if (strcmp(url, "/poll.xml") == 0 && devname != NULL) {
+ } else if (strcmp(url, "/poll.xml") == 0 && (devname != NULL || usb)) {
ret = SendPollResponse(conn);
} else
ret = web_send_data(conn, UNKNOWN, MHD_HTTP_NOT_FOUND, false, false, NULL); // no free, no copy
@@ -544,7 +544,7 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
if (strcmp(url, "/devpost.html") == 0) {
const char *fun = MHD_lookup_connection_value(conn, MHD_GET_ARGUMENT_KIND, "fn");
const char *dev = MHD_lookup_connection_value(conn, MHD_GET_ARGUMENT_KIND, "dev");
- const char *usbp = MHD_lookup_connection_value(conn, MHD_GET_ARGUMENT_KIND, "usbb");
+ const char *usbp = MHD_lookup_connection_value(conn, MHD_GET_ARGUMENT_KIND, "usb");
if (*up_data_size != 0) {
MHD_post_process(cp->conn_pp, up_data, *up_data_size);
*up_data_size = 0;
@@ -554,7 +554,7 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
free(devname);
devname = NULL;
}
- if (usbp != NULL && *usbp == '1') {
+ if (usbp != NULL && strcmp(usbp, "true") == 0) {
Manager::Get()->AddDriver( "HID Controller", Driver::ControllerInterface_Hid );
usb = true;
} else {
@@ -572,9 +572,11 @@ int Webserver::Handler (struct MHD_Connection *conn, const char *url,
Manager::Get()->RemoveDriver(devname);
free(devname);
devname = NULL;
+ usb = false;
}
homeId = 0;
} else if (strcmp(fun, "reset") == 0) { /* reset */
+ // not handled for USB
Manager::Get()->ResetController(homeId);
Manager::Get()->RemoveDriver(devname);
sleep(5);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-iot/openzwave-controlpanel.git
More information about the Debian-iot-packaging
mailing list