summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@web.de>2008-03-12 19:08:53 +0100
committerDanny Kukawka <danny.kukawka@web.de>2008-03-12 19:08:53 +0100
commitea8441f5b0fd783d5803c5c7a0a1c95e72bf1a01 (patch)
treea1fe88065c38598c1c2ce59fb8663fb1eee3ac4e /tools
parent5610b603840dfb264db039756c8d541106df2305 (diff)
added support for Tablet PCs
Added support for Tablet PCs with these features: * identify Wacom and Finepoint Tablet PC devices and port/irq * set system.formfactor.subtype to 'tabletpc' this allow the desktop to handle special tasks for Tablet PCs as e.g. show OnScreen Keyboard * added setserial helper to setup /dev/ttyS* devices with sepcial parameter if needed * added fdi-file to call for special Tablet devices setserial with needed parameter where the kernel can't setup the device correct This patch is already included in the SUSE hal package since 08/2005.
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am4
-rw-r--r--tools/hal-system-setserial.c77
2 files changed, 81 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 6d4db2e6..cab521ee 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -102,6 +102,7 @@ libexec_PROGRAMS = \
hal-storage-closetray \
hal-storage-cleanup-mountpoint \
hal-storage-cleanup-all-mountpoints \
+ hal-system-setserial \
hal-system-power-pm-is-supported
if HAVE_PMU
@@ -142,6 +143,9 @@ hal_storage_cleanup_mountpoint_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(t
hal_storage_cleanup_all_mountpoints_SOURCES = hal-storage-cleanup-all-mountpoints.c hal-storage-shared.c hal-storage-shared.h
hal_storage_cleanup_all_mountpoints_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+hal_system_setserial_SOURCES = hal-system-setserial.c
+hal_system_setserial_LDADD =
+
if HAVE_PMU
hal_system_power_pmu_SOURCES = hal-system-power-pmu.c
hal_system_power_pmu_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
diff --git a/tools/hal-system-setserial.c b/tools/hal-system-setserial.c
new file mode 100644
index 00000000..f38689e5
--- /dev/null
+++ b/tools/hal-system-setserial.c
@@ -0,0 +1,77 @@
+/*
+ * Licensed under the GNU General Public License Version 2
+ *
+ * Copyright (C) 2005-2008 Danny Kukawka <danny.kukawka@web.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <syslog.h>
+
+#define MAX_CMD_LENGTH 256
+
+static int debug = 0;
+
+
+int main (int argc, const char *argv[])
+{
+ int ret_val = EXIT_FAILURE;
+ char *udi = NULL;
+ char *irq = NULL;
+ char *port = NULL;
+ char *baud_base = NULL;
+ char *input_dev = NULL;
+ char cmd[MAX_CMD_LENGTH+1];
+
+ if (getenv ("HALD_VERBOSE") != NULL )
+ debug = 1;
+ if (debug)
+ syslog (LOG_INFO, "hal-system-setserial started in debug mode." );
+
+ udi = getenv("UDI");
+ irq = getenv("HAL_PROP_PNP_SERIAL_IRQ");
+ port = getenv("HAL_PROP_PNP_SERIAL_PORT");
+ baud_base = getenv("HAL_PROP_PNP_SERIAL_BAUD_BASE");
+ input_dev = getenv("HAL_PROP_INPUT_DEVICE_SET");
+
+ if (udi == NULL || irq == NULL || port == NULL || input_dev == NULL) {
+ syslog (LOG_INFO, "Missing env variable, exit NOW." );
+ return ret_val;
+ }
+
+ if (baud_base != NULL)
+ snprintf( cmd, MAX_CMD_LENGTH, "/bin/setserial %s port %s irq %s baud_base %s autoconfig", input_dev, port, irq, baud_base);
+ else
+ snprintf( cmd, MAX_CMD_LENGTH, "/bin/setserial %s port %s irq %s autoconfig", input_dev, port, irq);
+
+ syslog (LOG_INFO, "Collected setserial options and called(%d): %s ", system(cmd), cmd);
+
+ ret_val = EXIT_SUCCESS;
+
+ return ret_val;
+}
+