--- Begin Message ---
Author: dodji
Date: 2007-03-19 23:26:43 +0100 (Mon, 19 Mar 2007)
New Revision: 1414
Modified:
trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
Log:
Use icalcomponent instead of EcalComponent
* applications/openmoko-today/src/today-events-area.c:
Do not use ECalComponent anymore, but rather
the underlying icalcomponent.
ECalComponent was actually useless and was
just eating more memory.
* applications/openmoko-today/src/today-utils.c,h:
ditto.
Added icalcomponent_has_alarm() to detect if an
icalcomponent has alarms.
Modified: trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
2007-03-19 22:26:32 UTC (rev 1413)
+++ trunk/src/target/OM-2007/applications/openmoko-today/ChangeLog
2007-03-19 22:26:43 UTC (rev 1414)
@@ -1,3 +1,15 @@
+Mon, 19 Mar 2007 23:15:46 +0100 Dodji Seketeli
+
+ * applications/openmoko-today/src/today-events-area.c:
+ Do not use ECalComponent anymore, but rather
+ the underlying icalcomponent.
+ ECalComponent was actually useless and was
+ just eating more memory.
+ * applications/openmoko-today/src/today-utils.c,h:
+ ditto.
+ Added icalcomponent_has_alarm() to detect if an
+ icalcomponent has alarms.
+
Mon, 19 Mar 2007 19:59:27 +0100 Dodji Seketeli
* applications/openmoko-today/src/today-events-area.c:
Modified:
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
2007-03-19 22:26:32 UTC (rev 1413)
+++
trunk/src/target/OM-2007/applications/openmoko-today/src/today-events-area.c
2007-03-19 22:26:43 UTC (rev 1414)
@@ -23,16 +23,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
-#include <libecal/e-cal-time-util.h>
-#include <libecal/e-cal-component.h>
+/*#include <libecal/e-cal-time-util.h>*/
+/*#include <libical/e-cal-component.h>*/
+#include <libical/icalcomponent.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtktable.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtklabel.h>
+#include "today-utils.h"
#include "today-events-area.h"
+
struct _TodayEventsAreaPrivate {
GList *events ;
GtkWidget *left ;
@@ -84,8 +87,6 @@
static void render_events_page (TodayEventsArea *a_this,
GList *a_from) ;
static void render_events_page_auto (TodayEventsArea *a_this) ;
-static void e_cal_component_list_free (GList * list) ;
-static gchar* icaltime_to_pretty_string (const icaltimetype *timetype) ;
static void event_selected_signal (TodayEventsArea *a_this,
guint a_index) ;
static void events_added_signal (TodayEventsArea *a_this,
@@ -215,7 +216,7 @@
if (self->priv->events)
{
- e_cal_component_list_free (self->priv->events) ;
+ e_cal_free_object_list (self->priv->events) ;
self->priv->events = NULL ;
}
self->priv->cur_event = NULL ;
@@ -371,34 +372,7 @@
}
}
-/**
- * e_cal_component_list_free:
- * @list: the list ECalComooment to free
- *
- * Free a list of ECalComponent
- */
static void
-e_cal_component_list_free (GList * a_list)
-{
- GList *cur = NULL;
-
- for (cur = a_list; cur; cur = cur->next)
- {
- /*if an element of the list is not of type ECalComponent, leak it */
- if (cur->data && E_IS_CAL_COMPONENT (cur->data))
- {
- g_object_unref (G_OBJECT (cur->data));
- cur->data = NULL;
- }
- else
- {
- g_warning ("cur->data is not of type ECalComponent !");
- }
- }
- g_list_free (a_list);
-}
-
-static void
clear_right_hand_side (TodayEventsArea *a_this)
{
g_return_if_fail (a_this
@@ -581,11 +555,10 @@
GList *a_event)
{
GtkWidget *infoline, *label, *event_box, *icon ;
- ECalComponentText text ;
- ECalComponentDateTime date ;
- ECalComponent *event=NULL ;
+ icaltimetype date ;
+ icalcomponent *event=NULL ;
int event_index=0 ;
- gchar *tmp_str=NULL, *tmp_str2=NULL ;
+ gchar *tmp_str=NULL, *tmp_str2=NULL, *summary=NULL ;
gboolean has_alarm=FALSE, is_todo=FALSE, is_event=FALSE ;
g_return_if_fail (a_this
@@ -597,78 +570,81 @@
g_return_if_fail (a_event && a_event->data) ;
event = a_event->data ;
- g_return_if_fail (E_IS_CAL_COMPONENT (event)) ;
+ g_return_if_fail (icalcomponent_isa_component (event)) ;
+
event_index = g_list_position (a_this->priv->events, a_event) ;
g_return_if_fail (event_index >= 0) ;
/*does the comp has an alarm ?*/
- has_alarm = e_cal_component_has_alarms (event) ;
+ has_alarm = icalcomponent_has_alarm (event);
/*is the comp a todo item ? */
- is_todo = (e_cal_component_get_vtype (event) == E_CAL_COMPONENT_TODO);
+ is_todo = (icalcomponent_isa (event) == ICAL_VTODO_COMPONENT);
/*is the comp a calendar event ?*/
- is_event = (e_cal_component_get_vtype (event) == E_CAL_COMPONENT_EVENT);
+ is_event = (icalcomponent_isa (event) == ICAL_VEVENT_COMPONENT);
/*a comp must be either a calendar event or a todo item*/
g_return_if_fail (is_event != is_todo) ;
/*get the event summary*/
- e_cal_component_get_summary (event, &text) ;
+ summary = (gchar*) icalcomponent_get_summary (event) ;
/*get the event starting date*/
if (is_event)
- e_cal_component_get_dtstart (event, &date) ;
- else if (is_todo)
{
- e_cal_component_get_due (event, &date) ;
+ date = icalcomponent_get_dtstart (event) ;
+ tmp_str = icaltime_to_pretty_string (&date) ;
}
-
- if (date.value)
+ else if (is_todo)
{
- tmp_str = icaltime_to_pretty_string (date.value) ;
- e_cal_component_free_datetime (&date) ;
+ date = icalcomponent_get_due (event) ;
+ tmp_str = icaltime_to_pretty_string (&date) ;
}
+
/*build event infoline*/
if (tmp_str)
{
- tmp_str2 = g_strdup_printf ("%s %s", text.value, tmp_str) ;
+ tmp_str2 = g_strdup_printf ("%s %s", summary, tmp_str) ;
g_free (tmp_str) ;
}
else
{
- tmp_str2 = g_strdup_printf ("%s", text.value) ;
+ tmp_str2 = g_strdup_printf ("%s", summary) ;
}
label = gtk_label_new (tmp_str2) ;
gtk_misc_set_alignment (GTK_MISC (label), 0, 0) ;
gtk_widget_show (label) ;
g_free (tmp_str2) ;
infoline = gtk_hbox_new (TRUE, 0) ;
+ gtk_box_set_homogeneous (GTK_BOX (infoline), FALSE) ;
gtk_widget_show (infoline) ;
- gtk_box_pack_start_defaults (GTK_BOX (infoline), label) ;
+ gtk_box_pack_start (GTK_BOX (infoline), label, FALSE, FALSE, 0) ;
icon = gtk_image_new () ;
- if (is_event)
+
+ if (has_alarm)
{
gtk_image_set_from_stock (GTK_IMAGE (icon),
- "openmoko-today-event",
+ "openmoko-today-bell",
GTK_ICON_SIZE_MENU);
}
- else if (is_todo)
+ else if (is_event)
{
gtk_image_set_from_stock (GTK_IMAGE (icon),
- "openmoko-today-todo",
+ "openmoko-today-event",
GTK_ICON_SIZE_MENU);
}
- else if (has_alarm)
+ else if (is_todo)
{
gtk_image_set_from_stock (GTK_IMAGE (icon),
- "openmoko-today-bell",
+ "openmoko-today-todo",
GTK_ICON_SIZE_MENU);
}
+
gtk_misc_set_alignment (GTK_MISC (icon), 0, 0);
gtk_widget_show_all (icon) ;
- gtk_box_pack_start_defaults (GTK_BOX (infoline), icon) ;
+ gtk_box_pack_start (GTK_BOX (infoline), icon, FALSE, FALSE, 6) ;
event_box = gtk_event_box_new () ;
gtk_widget_show (event_box) ;
g_object_set_data (G_OBJECT (event_box),
@@ -816,7 +792,7 @@
g_return_if_fail (a_this->priv) ;
if (a_this->priv->events)
- e_cal_component_list_free (a_this->priv->events) ;
+ e_cal_free_object_list (a_this->priv->events) ;
a_this->priv->events = a_events ;
a_this->priv->nb_events = get_nb_events_real (a_this) ;
Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
2007-03-19 22:26:32 UTC (rev 1413)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.c
2007-03-19 22:26:43 UTC (rev 1414)
@@ -28,7 +28,9 @@
*
* Free a list of ECalComponent
*/
+#include <string.h>
#include "today-utils.h"
+#include <libical/icalcomponent.h>
#define LOG_ERROR \
g_warning ("Got error '%s', code '%d'", \
@@ -36,6 +38,9 @@
#define FREE_ERROR g_error_free (error) ; error = NULL ;
+static ECal *calendar_db = NULL;
+static ECal *tasks_db = NULL;
+
void
e_cal_component_list_free (GList * list)
{
@@ -142,24 +147,25 @@
GList *
today_get_today_events ()
{
- GList *result=NULL, *ical_comps=NULL,
- *ecal_comps=NULL, *ecal_comps2=NULL;
- ECal *ecal = NULL;
+ GList *result=NULL, *ical_comps=NULL, *ical_comps2=NULL;
GError *error = NULL;
gchar *query = NULL;
- ecal = e_cal_new_system_calendar ();
- g_return_val_if_fail (ecal, NULL);
+ if (!calendar_db)
+ {
+ calendar_db = e_cal_new_system_calendar ();
+ g_return_val_if_fail (calendar_db, NULL);
- if (!e_cal_open (ecal, FALSE, &error))
- {
- g_warning ("failed to open the calendar");
+ if (!e_cal_open (calendar_db, TRUE, &error))
+ {
+ g_warning ("failed to open the calendar");
+ }
+ if (error)
+ {
+ LOG_ERROR;
+ goto out;
+ }
}
- if (error)
- {
- LOG_ERROR;
- goto out;
- }
/*
query = g_strdup_printf ("(occur-in-time-range? "
@@ -168,7 +174,7 @@
")");
*/
query = g_strdup_printf ("#t");
- e_cal_get_object_list (ecal, query, &ical_comps, &error);
+ e_cal_get_object_list (calendar_db, query, &ical_comps, &error);
g_free (query) ;
query = NULL ;
if (error)
@@ -177,32 +183,23 @@
FREE_ERROR;
}
- /*
- * build a list of ECalComponent, out of the list of icalcomponents
- * when an icalcomponent is set to an ECalComponent, the later
- * becomes responsible of freeing the former's memory
- */
- if (ical_comps)
+ if (!tasks_db)
{
- ecal_comps = icalcomps_to_ecalcomps (ical_comps) ;
- g_list_free (ical_comps) ;
- ical_comps = NULL ;
+ tasks_db = e_cal_new_system_tasks ();
+ g_return_val_if_fail (tasks_db, NULL);
+ if (!e_cal_open (tasks_db, TRUE, &error))
+ {
+ g_warning ("failed to open the tasks");
+ }
+ if (error)
+ {
+ LOG_ERROR;
+ goto out;
+ }
}
- ecal = e_cal_new_system_tasks ();
- g_return_val_if_fail (ecal, NULL);
- if (!e_cal_open (ecal, FALSE, &error))
- {
- g_warning ("failed to open the calendar");
- }
- if (error)
- {
- LOG_ERROR;
- goto out;
- }
-
query = g_strdup_printf ("#t");
- e_cal_get_object_list (ecal, query, &ical_comps, &error);
+ e_cal_get_object_list (tasks_db, query, &ical_comps2, &error);
g_free (query) ;
query = NULL ;
if (error)
@@ -210,16 +207,10 @@
LOG_ERROR;
FREE_ERROR ;
}
- if (ical_comps)
- {
- ecal_comps2 = icalcomps_to_ecalcomps (ical_comps) ;
- g_list_free (ical_comps) ;
- ical_comps = NULL ;
- }
- ecal_comps = g_list_concat (ecal_comps, ecal_comps2) ;
+ ical_comps = g_list_concat (ical_comps, ical_comps2) ;
- result = ecal_comps;
- ecal_comps = ecal_comps2 = NULL;
+ result = ical_comps;
+ ical_comps = ical_comps2 = NULL;
out:
if (ical_comps)
@@ -227,14 +218,10 @@
e_cal_free_object_list (ical_comps);
}
- if (ecal_comps)
+ if (ical_comps2)
{
- e_cal_component_list_free (ecal_comps);
+ e_cal_free_object_list (ical_comps);
}
- if (ecal_comps2)
- {
- e_cal_component_list_free (ecal_comps2);
- }
/*
the calender must stay alive during the app's lifetime
@@ -248,12 +235,27 @@
{
g_error_free (error);
}
-
if (query)
{
g_free (query);
}
-
return result;
}
+gboolean
+icalcomponent_has_alarm (icalcomponent *a_icalcomp)
+{
+ icalcompiter iter ;
+
+ g_return_val_if_fail (a_icalcomp, FALSE) ;
+ g_return_val_if_fail (icalcomponent_isa_component (a_icalcomp), FALSE) ;
+
+ for (iter = icalcomponent_begin_component (a_icalcomp,
+ ICAL_VALARM_COMPONENT);
+ icalcompiter_deref (&iter) != NULL ;
+ icalcompiter_next (&iter))
+ {
+ return TRUE ;
+ }
+ return FALSE ;
+}
Modified: trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
2007-03-19 22:26:32 UTC (rev 1413)
+++ trunk/src/target/OM-2007/applications/openmoko-today/src/today-utils.h
2007-03-19 22:26:43 UTC (rev 1414)
@@ -25,12 +25,14 @@
#define __TODAY_UTILS_H__
#include <glib.h>
+#include <libical/icalcomponent.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
GList* today_get_today_events () ;
void e_cal_component_list_free (GList * list) ;
gchar* icaltime_to_pretty_string (const icaltimetype *timetype) ;
+gboolean icalcomponent_has_alarm (icalcomponent *a_icalcomp) ;
#endif /*__TODAY_UTILS_H__*/
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-03-19 23:58:17 +0100 (Mon, 19 Mar 2007)
New Revision: 1415
Added:
trunk/src/target/debug/
trunk/src/target/debug/input/
trunk/src/target/debug/input/Makefile
trunk/src/target/debug/input/input
trunk/src/target/debug/input/input.c
trunk/src/target/debug/input/input.h
trunk/src/target/debug/input/input.pro
Log:
add small program for testing input codes
Added: trunk/src/target/debug/input/Makefile
===================================================================
--- trunk/src/target/debug/input/Makefile 2007-03-19 22:26:43 UTC (rev
1414)
+++ trunk/src/target/debug/input/Makefile 2007-03-19 22:58:17 UTC (rev
1415)
@@ -0,0 +1,155 @@
+#############################################################################
+# Makefile for building: input
+# Generated by qmake (2.01a) (Qt 4.2.2) on: Mo Mrz 19 22:59:16 2007
+# Project: input.pro
+# Template: app
+# Command: /usr/lib/qt4/bin/qmake -unix -o Makefile input.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+LEX = flex
+YACC = yacc
+DEFINES =
+CFLAGS = -pipe -std=c99 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -g -Wall -W $(DEFINES)
+CXXFLAGS = -pipe -g -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-Wall -W $(DEFINES)
+LEXFLAGS =
+YACCFLAGS = -d
+INCPATH = -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I.
+LINK = g++
+LFLAGS = -Wl,-rpath,/usr/lib/qt4/lib
+LIBS = $(SUBLIBS) -lglib-2.0
+AR = ar cqs
+RANLIB =
+QMAKE = /usr/lib/qt4/bin/qmake
+TAR = tar -cf
+COMPRESS = gzip -9f
+COPY = cp -f
+COPY_FILE = $(COPY)
+COPY_DIR = $(COPY) -r
+INSTALL_FILE = install -m 644 -p
+INSTALL_DIR = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE = rm -f
+SYMLINK = ln -sf
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = .obj/
+
+####### Files
+
+SOURCES = input.c
+OBJECTS = .obj/input.o
+DIST = /usr/lib/qt4/mkspecs/common/unix.conf \
+ /usr/lib/qt4/mkspecs/common/g++.conf \
+ /usr/lib/qt4/mkspecs/common/linux.conf \
+ /usr/lib/qt4/mkspecs/qconfig.pri \
+ /usr/lib/qt4/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt4/mkspecs/features/qt_config.prf \
+ /usr/lib/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt4/mkspecs/features/default_pre.prf \
+ /usr/lib/qt4/mkspecs/features/debug.prf \
+ /usr/lib/qt4/mkspecs/features/default_post.prf \
+ /usr/lib/qt4/mkspecs/features/link_pkgconfig.prf \
+ /usr/lib/qt4/mkspecs/features/warn_on.prf \
+ input.pro
+QMAKE_TARGET = input
+DESTDIR =
+TARGET = input
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: input.pro /usr/lib/qt4/mkspecs/linux-g++/qmake.conf
/usr/lib/qt4/mkspecs/common/unix.conf \
+ /usr/lib/qt4/mkspecs/common/g++.conf \
+ /usr/lib/qt4/mkspecs/common/linux.conf \
+ /usr/lib/qt4/mkspecs/qconfig.pri \
+ /usr/lib/qt4/mkspecs/features/qt_functions.prf \
+ /usr/lib/qt4/mkspecs/features/qt_config.prf \
+ /usr/lib/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/lib/qt4/mkspecs/features/default_pre.prf \
+ /usr/lib/qt4/mkspecs/features/debug.prf \
+ /usr/lib/qt4/mkspecs/features/default_post.prf \
+ /usr/lib/qt4/mkspecs/features/link_pkgconfig.prf \
+ /usr/lib/qt4/mkspecs/features/warn_on.prf
+ $(QMAKE) -unix -o Makefile input.pro
+/usr/lib/qt4/mkspecs/common/unix.conf:
+/usr/lib/qt4/mkspecs/common/g++.conf:
+/usr/lib/qt4/mkspecs/common/linux.conf:
+/usr/lib/qt4/mkspecs/qconfig.pri:
+/usr/lib/qt4/mkspecs/features/qt_functions.prf:
+/usr/lib/qt4/mkspecs/features/qt_config.prf:
+/usr/lib/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/lib/qt4/mkspecs/features/default_pre.prf:
+/usr/lib/qt4/mkspecs/features/debug.prf:
+/usr/lib/qt4/mkspecs/features/default_post.prf:
+/usr/lib/qt4/mkspecs/features/link_pkgconfig.prf:
+/usr/lib/qt4/mkspecs/features/warn_on.prf:
+qmake: FORCE
+ @$(QMAKE) -unix -o Makefile input.pro
+
+dist:
+ @$(CHK_DIR_EXISTS) .obj/input1.0.0 || $(MKDIR) .obj/input1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .obj/input1.0.0/ && (cd
`dirname .obj/input1.0.0` && $(TAR) input1.0.0.tar input1.0.0 && $(COMPRESS)
input1.0.0.tar) && $(MOVE) `dirname .obj/input1.0.0`/input1.0.0.tar.gz . &&
$(DEL_FILE) -r .obj/input1.0.0
+
+
+yaccclean:
+lexclean:
+clean:compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+compiler_clean:
+
+####### Compile
+
+.obj/input.o: input.c input.h
+ $(CC) -c $(CFLAGS) $(INCPATH) -o .obj/input.o input.c
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
Property changes on: trunk/src/target/debug/input/Makefile
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/debug/input/input
===================================================================
(Binary files differ)
Property changes on: trunk/src/target/debug/input/input
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/target/debug/input/input.c
===================================================================
--- trunk/src/target/debug/input/input.c 2007-03-19 22:26:43 UTC (rev
1414)
+++ trunk/src/target/debug/input/input.c 2007-03-19 22:58:17 UTC (rev
1415)
@@ -0,0 +1,77 @@
+/**********************************************************************
+ * open all input nodes, listen for and show events
+ * Authored by Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
+ * (C) 2007 OpenMoko Inc.
+ * GPLv2
+ **********************************************************************/
+
+#include "input.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+#include <glib-2.0/glib.h>
+
+#define MAX_INPUT_NODE 9
+
+int main( int argc, char** argv )
+{
+ fd_set fdset;
+ int fd[MAX_INPUT_NODE];
+ int highestfd = -1;
+ int maxfd = -1;
+ for ( int i = 0; i < MAX_INPUT_NODE+1; ++i )
+ {
+ gchar event[7] = "event\0\0";
+ event[5] = 0x30 + i;
+ gchar* filename = g_build_filename( "/dev/input", &event, NULL );
+ g_debug( "opening '%s'", filename );
+ int result = open( filename, O_RDONLY );
+ if ( result != -1 )
+ {
+ fd[i] = result;
+ maxfd++;
+ g_debug( "%s open ok fd = %d", filename, result );
+ if ( result > highestfd )
+ highestfd = result;
+ }
+ else
+ {
+ g_debug( "can't open %s (%s)", filename, strerror(errno) );
+ break;
+ }
+ g_free( filename );
+ }
+ if ( maxfd == -1 )
+ {
+ g_debug( "can't open ANY input events -- aborting." );
+ return -1;
+ }
+
+ while ( TRUE )
+ {
+ FD_ZERO(&fdset);
+ for ( int i = 0; i < maxfd+1; ++i )
+ FD_SET( fd[i], &fdset );
+ int result = select( highestfd+1, &fdset, NULL, NULL, NULL );
+ g_debug( "select returned %d", result );
+ if ( result == 1 )
+ {
+ struct input_event event;
+ for( int i = 0; i < maxfd+1; ++i )
+ {
+ if ( FD_ISSET( fd[i], &fdset ) )
+ {
+ int size = read( fd[i], &event, sizeof( struct input_event
) );
+ g_debug( "read %d bytes from fd %d", size, fd[i] );
+ g_debug( "input event = ( %0x, %0x, %0x )", event.type,
event.code, event.value );
+ }
+ }
+ }
+ }
+
+ return 0;
+}
Property changes on: trunk/src/target/debug/input/input.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/debug/input/input.h
===================================================================
--- trunk/src/target/debug/input/input.h 2007-03-19 22:26:43 UTC (rev
1414)
+++ trunk/src/target/debug/input/input.h 2007-03-19 22:58:17 UTC (rev
1415)
@@ -0,0 +1,487 @@
+//last synchronization: 2.6.17
+
+#ifndef INPUT_H
+#define INPUT_H
+
+#include <linux/input.h>
+enum Feature
+{
+ Synchronous = EV_SYN,
+ Keys = EV_KEY,
+ Relative = EV_REL,
+ Absolute = EV_ABS,
+ Miscellaneous = EV_MSC,
+ Switches = EV_SW,
+ Leds = EV_LED,
+ Sound = EV_SND,
+ AutoRepeat = EV_REP,
+ ForceFeedback = EV_FF,
+ PowerManagement = EV_PWR,
+ ForceFeedbackStatus = EV_FF_STATUS,
+};
+
+enum Bus
+{
+ PCI = BUS_PCI,
+ ISAPNP = BUS_ISAPNP,
+ HIL = BUS_HIL,
+ BLUETOOTH = BUS_BLUETOOTH,
+ ISA = BUS_ISA,
+ I8042 = BUS_I8042,
+ XTKBD = BUS_XTKBD,
+ RS232 = BUS_RS232,
+ GAMEPORT = BUS_GAMEPORT,
+ PARPORT = BUS_PARPORT,
+ AMIGA = BUS_AMIGA,
+ ADB = BUS_ADB,
+ I2C = BUS_I2C,
+ HOST = BUS_HOST,
+ GSC = BUS_GSC,
+};
+
+enum Led
+{
+ Led_NUML = 0x00,
+ Led_CAPSL = 0x01,
+ Led_SCROLLL = 0x02,
+ Led_COMPOSE = 0x03,
+ Led_KANA = 0x04,
+ Led_SLEEP = 0x05,
+ Led_SUSPEND = 0x06,
+ Led_MUTE = 0x07,
+ Led_MISC = 0x08,
+ Led_MAIL = 0x09,
+ Led_CHARGING = 0x0a,
+};
+
+enum Key
+{
+ Key_RESERVED = 0,
+ Key_ESC = 1,
+ Key_1 = 2,
+ Key_2 = 3,
+ Key_3 = 4,
+ Key_4 = 5,
+ Key_5 = 6,
+ Key_6 = 7,
+ Key_7 = 8,
+ Key_8 = 9,
+ Key_9 = 10,
+ Key_0 = 11,
+ Key_MINUS = 12,
+ Key_EQUAL = 13,
+ Key_BACKSPACE = 14,
+ Key_TAB = 15,
+ Key_Q = 16,
+ Key_W = 17,
+ Key_E = 18,
+ Key_R = 19,
+ Key_T = 20,
+ Key_Y = 21,
+ Key_U = 22,
+ Key_I = 23,
+ Key_O = 24,
+ Key_P = 25,
+ Key_LEFTBRACE = 26,
+ Key_RIGHTBRACE = 27,
+ Key_ENTER = 28,
+ Key_LEFTCTRL = 29,
+ Key_A = 30,
+ Key_S = 31,
+ Key_D = 32,
+ Key_F = 33,
+ Key_G = 34,
+ Key_H = 35,
+ Key_J = 36,
+ Key_K = 37,
+ Key_L = 38,
+ Key_SEMICOLON = 39,
+ Key_APOSTROPHE = 40,
+ Key_GRAVE = 41,
+ Key_LEFTSHIFT = 42,
+ Key_BACKSLASH = 43,
+ Key_Z = 44,
+ Key_X = 45,
+ Key_C = 46,
+ Key_V = 47,
+ Key_B = 48,
+ Key_N = 49,
+ Key_M = 50,
+ Key_COMMA = 51,
+ Key_DOT = 52,
+ Key_SLASH = 53,
+ Key_RIGHTSHIFT = 54,
+ Key_KPASTERISK = 55,
+ Key_LEFTALT = 56,
+ Key_SPACE = 57,
+ Key_CAPSLOCK = 58,
+ Key_F1 = 59,
+ Key_F2 = 60,
+ Key_F3 = 61,
+ Key_F4 = 62,
+ Key_F5 = 63,
+ Key_F6 = 64,
+ Key_F7 = 65,
+ Key_F8 = 66,
+ Key_F9 = 67,
+ Key_F10 = 68,
+ Key_NUMLOCK = 69,
+ Key_SCROLLLOCK = 70,
+ Key_KP7 = 71,
+ Key_KP8 = 72,
+ Key_KP9 = 73,
+ Key_KPMINUS = 74,
+ Key_KP4 = 75,
+ Key_KP5 = 76,
+ Key_KP6 = 77,
+ Key_KPPLUS = 78,
+ Key_KP1 = 79,
+ Key_KP2 = 80,
+ Key_KP3 = 81,
+ Key_KP0 = 82,
+ Key_KPDOT = 83,
+
+ Key_ZENKAKUHANKAKU = 85,
+ Key_102ND = 86,
+ Key_F11 = 87,
+ Key_F12 = 88,
+ Key_RO = 89,
+ Key_KATAKANA = 90,
+ Key_HIRAGANA = 91,
+ Key_HENKAN = 92,
+ Key_KATAKANAHIRAGANA = 93,
+ Key_MUHENKAN = 94,
+ Key_KPJPCOMMA = 95,
+ Key_KPENTER = 96,
+ Key_RIGHTCTRL = 97,
+ Key_KPSLASH = 98,
+ Key_SYSRQ = 99,
+ Key_RIGHTALT = 100,
+ Key_LINEFEED = 101,
+ Key_HOME = 102,
+ Key_UP = 103,
+ Key_PAGEUP = 104,
+ Key_LEFT = 105,
+ Key_RIGHT = 106,
+ Key_END = 107,
+ Key_DOWN = 108,
+ Key_PAGEDOWN = 109,
+ Key_INSERT = 110,
+ Key_DELETE = 111,
+ Key_MACRO = 112,
+ Key_MUTE = 113,
+ Key_VOLUMEDOWN = 114,
+ Key_VOLUMEUP = 115,
+ Key_POWER = 116,
+ Key_KPEQUAL = 117,
+ Key_KPPLUSMINUS = 118,
+ Key_PAUSE = 119,
+
+ Key_KPCOMMA = 121,
+ Key_HANGUEL = 122,
+ Key_HANJA = 123,
+ Key_YEN = 124,
+ Key_LEFTMETA = 125,
+ Key_RIGHTMETA = 126,
+ Key_COMPOSE = 127,
+
+ Key_STOP = 128,
+ Key_AGAIN = 129,
+ Key_PROPS = 130,
+ Key_UNDO = 131,
+ Key_FRONT = 132,
+ Key_COPY = 133,
+ Key_OPEN = 134,
+ Key_PASTE = 135,
+ Key_FIND = 136,
+ Key_CUT = 137,
+ Key_HELP = 138,
+ Key_MENU = 139,
+ Key_CALC = 140,
+ Key_SETUP = 141,
+ Key_SLEEP = 142,
+ Key_WAKEUP = 143,
+ Key_FILE = 144,
+ Key_SENDFILE = 145,
+ Key_DELETEFILE = 146,
+ Key_XFER = 147,
+ Key_PROG1 = 148,
+ Key_PROG2 = 149,
+ Key_WWW = 150,
+ Key_MSDOS = 151,
+ Key_COFFEE = 152,
+ Key_DIRECTION = 153,
+ Key_CYCLEWINDOWS = 154,
+ Key_MAIL = 155,
+ Key_BOOKMARKS = 156,
+ Key_COMPUTER = 157,
+ Key_BACK = 158,
+ Key_FORWARD = 159,
+ Key_CLOSECD = 160,
+ Key_EJECTCD = 161,
+ Key_EJECTCLOSECD = 162,
+ Key_NEXTSONG = 163,
+ Key_PLAYPAUSE = 164,
+ Key_PREVIOUSSONG = 165,
+ Key_STOPCD = 166,
+ Key_RECORD = 167,
+ Key_REWIND = 168,
+ Key_PHONE = 169,
+ Key_ISO = 170,
+ Key_CONFIG = 171,
+ Key_HOMEPAGE = 172,
+ Key_REFRESH = 173,
+ Key_EXIT = 174,
+ Key_MOVE = 175,
+ Key_EDIT = 176,
+ Key_SCROLLUP = 177,
+ Key_SCROLLDOWN = 178,
+ Key_KPLEFTPAREN = 179,
+ Key_KPRIGHTPAREN = 180,
+
+ Key_F13 = 183,
+ Key_F14 = 184,
+ Key_F15 = 185,
+ Key_F16 = 186,
+ Key_F17 = 187,
+ Key_F18 = 188,
+ Key_F19 = 189,
+ Key_F20 = 190,
+ Key_F21 = 191,
+ Key_F22 = 192,
+ Key_F23 = 193,
+ Key_F24 = 194,
+
+ Key_PLAYCD = 200,
+ Key_PAUSECD = 201,
+ Key_PROG3 = 202,
+ Key_PROG4 = 203,
+ Key_SUSPEND = 205,
+ Key_CLOSE = 206,
+ Key_PLAY = 207,
+ Key_FASTFORWARD = 208,
+ Key_BASSBOOST = 209,
+ Key_PRINT = 210,
+ Key_HP = 211,
+ Key_CAMERA = 212,
+ Key_SOUND = 213,
+ Key_QUESTION = 214,
+ Key_EMAIL = 215,
+ Key_CHAT = 216,
+ Key_SEARCH = 217,
+ Key_CONNECT = 218,
+ Key_FINANCE = 219,
+ Key_SPORT = 220,
+ Key_SHOP = 221,
+ Key_ALTERASE = 222,
+ Key_CANCEL = 223,
+ Key_BRIGHTNESSDOWN = 224,
+ Key_BRIGHTNESSUP = 225,
+ Key_MEDIA = 226,
+
+ Key_SWITCHVIDEOMODE = 227,
+ Key_KBDILLUMTOGGLE = 228,
+ Key_KBDILLUMDOWN = 229,
+ Key_KBDILLUMUP = 230,
+
+ Key_SEND = 231,
+ Key_REPLY = 232,
+ Key_FORWARDMAIL = 233,
+ Key_SAVE = 234,
+ Key_DOCUMENTS = 235,
+
+ Key_BATTERY = 236,
+
+ Key_UNKNOWN = 240,
+
+ Button_MISC = 0x100,
+ Button_0 = 0x100,
+ Button_1 = 0x101,
+ Button_2 = 0x102,
+ Button_3 = 0x103,
+ Button_4 = 0x104,
+ Button_5 = 0x105,
+ Button_6 = 0x106,
+ Button_7 = 0x107,
+ Button_8 = 0x108,
+ Button_9 = 0x109,
+
+ Button_MOUSE = 0x110,
+ Button_LEFT = 0x110,
+ Button_RIGHT = 0x111,
+ Button_MIDDLE = 0x112,
+ Button_SIDE = 0x113,
+ Button_EXTRA = 0x114,
+ Button_FORWARD = 0x115,
+ Button_BACK = 0x116,
+ Button_TASK = 0x117,
+
+ Button_JOYSTICK = 0x120,
+ Button_TRIGGER = 0x120,
+ Button_THUMB = 0x121,
+ Button_THUMB2 = 0x122,
+ Button_TOP = 0x123,
+ Button_TOP2 = 0x124,
+ Button_PINKIE = 0x125,
+ Button_BASE = 0x126,
+ Button_BASE2 = 0x127,
+ Button_BASE3 = 0x128,
+ Button_BASE4 = 0x129,
+ Button_BASE5 = 0x12a,
+ Button_BASE6 = 0x12b,
+ Button_DEAD = 0x12f,
+
+ Button_GAMEPAD = 0x130,
+ Button_A = 0x130,
+ Button_B = 0x131,
+ Button_C = 0x132,
+ Button_X = 0x133,
+ Button_Y = 0x134,
+ Button_Z = 0x135,
+ Button_TL = 0x136,
+ Button_TR = 0x137,
+ Button_TL2 = 0x138,
+ Button_TR2 = 0x139,
+ Button_SELECT = 0x13a,
+ Button_START = 0x13b,
+ Button_MODE = 0x13c,
+ Button_THUMBL = 0x13d,
+ Button_THUMBR = 0x13e,
+
+ Button_DIGI = 0x140,
+ Button_TOOL_PEN = 0x140,
+ Button_TOOL_RUBBER = 0x141,
+ Button_TOOL_BRUSH = 0x142,
+ Button_TOOL_PENCIL = 0x143,
+ Button_TOOL_AIRBRUSH = 0x144,
+ Button_TOOL_FINGER = 0x145,
+ Button_TOOL_MOUSE = 0x146,
+ Button_TOOL_LENS = 0x147,
+ Button_TOUCH = 0x14a,
+ Button_STYLUS = 0x14b,
+ Button_STYLUS2 = 0x14c,
+ Button_TOOL_DOUBLETAP = 0x14d,
+ Button_TOOL_TRIPLETAP = 0x14e,
+
+ Button_WHEEL = 0x150,
+ Button_GEAR_DOWN = 0x150,
+ Button_GEAR_UP = 0x151,
+
+ Key_OK = 0x160,
+ Key_SELECT = 0x161,
+ Key_GOTO = 0x162,
+ Key_CLEAR = 0x163,
+ Key_POWER2 = 0x164,
+ Key_OPTION = 0x165,
+ Key_INFO = 0x166,
+ Key_TIME = 0x167,
+ Key_VENDOR = 0x168,
+ Key_ARCHIVE = 0x169,
+ Key_PROGRAM = 0x16a,
+ Key_CHANNEL = 0x16b,
+ Key_FAVORITES = 0x16c,
+ Key_EPG = 0x16d,
+ Key_PVR = 0x16e,
+ Key_MHP = 0x16f,
+ Key_LANGUAGE = 0x170,
+ Key_TITLE = 0x171,
+ Key_SUBTITLE = 0x172,
+ Key_ANGLE = 0x173,
+ Key_ZOOM = 0x174,
+ Key_MODE = 0x175,
+ Key_KEYBOARD = 0x176,
+ Key_SCREEN = 0x177,
+ Key_PC = 0x178,
+ Key_TV = 0x179,
+ Key_TV2 = 0x17a,
+ Key_VCR = 0x17b,
+ Key_VCR2 = 0x17c,
+ Key_SAT = 0x17d,
+ Key_SAT2 = 0x17e,
+ Key_CD = 0x17f,
+ Key_TAPE = 0x180,
+ Key_RADIO = 0x181,
+ Key_TUNER = 0x182,
+ Key_PLAYER = 0x183,
+ Key_TEXT = 0x184,
+ Key_DVD = 0x185,
+ Key_AUX = 0x186,
+ Key_MP3 = 0x187,
+ Key_AUDIO = 0x188,
+ Key_VIDEO = 0x189,
+ Key_DIRECTORY = 0x18a,
+ Key_LIST = 0x18b,
+ Key_MEMO = 0x18c,
+ Key_CALENDAR = 0x18d,
+ Key_RED = 0x18e,
+ Key_GREEN = 0x18f,
+ Key_YELLOW = 0x190,
+ Key_BLUE = 0x191,
+ Key_CHANNELUP = 0x192,
+ Key_CHANNELDOWN = 0x193,
+ Key_FIRST = 0x194,
+ Key_LAST = 0x195,
+ Key_AB = 0x196,
+ Key_NEXT = 0x197,
+ Key_RESTART = 0x198,
+ Key_SLOW = 0x199,
+ Key_SHUFFLE = 0x19a,
+ Key_BREAK = 0x19b,
+ Key_PREVIOUS = 0x19c,
+ Key_DIGITS = 0x19d,
+ Key_TEEN = 0x19e,
+ Key_TWEN = 0x19f,
+
+ Key_DEL_EOL = 0x1c0,
+ Key_DEL_EOS = 0x1c1,
+ Key_INS_LINE = 0x1c2,
+ Key_DEL_LINE = 0x1c3,
+
+ Key_FN = 0x1d0,
+ Key_FN_ESC = 0x1d1,
+ Key_FN_F1 = 0x1d2,
+ Key_FN_F2 = 0x1d3,
+ Key_FN_F3 = 0x1d4,
+ Key_FN_F4 = 0x1d5,
+ Key_FN_F5 = 0x1d6,
+ Key_FN_F6 = 0x1d7,
+ Key_FN_F7 = 0x1d8,
+ Key_FN_F8 = 0x1d9,
+ Key_FN_F9 = 0x1da,
+ Key_FN_F10 = 0x1db,
+ Key_FN_F11 = 0x1dc,
+ Key_FN_F12 = 0x1dd,
+ Key_FN_1 = 0x1de,
+ Key_FN_2 = 0x1df,
+ Key_FN_D = 0x1e0,
+ Key_FN_E = 0x1e1,
+ Key_FN_F = 0x1e2,
+ Key_FN_S = 0x1e3,
+ Key_FN_B = 0x1e4,
+
+ Key_BRL_DOT1 = 0x1f1,
+ Key_BRL_DOT2 = 0x1f2,
+ Key_BRL_DOT3 = 0x1f3,
+ Key_BRL_DOT4 = 0x1f4,
+ Key_BRL_DOT5 = 0x1f5,
+ Key_BRL_DOT6 = 0x1f6,
+ Key_BRL_DOT7 = 0x1f7,
+ Key_BRL_DOT8 = 0x1f8,
+
+};
+
+enum Sound
+{
+ Sound_CLICK = 0x00,
+ Sound_BELL = 0x01,
+ Sound_TONE = 0x02,
+};
+
+enum Switch
+{
+ Switch_LID = 0x00 /* set = lid shut */,
+ Switch_TABLET_MODE = 0x01 /* set = tablet mode */,
+ Switch_HEADPHONE_INSERT = 0x02 /* set = inserted */,
+};
+
+#endif
Property changes on: trunk/src/target/debug/input/input.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/debug/input/input.pro
===================================================================
--- trunk/src/target/debug/input/input.pro 2007-03-19 22:26:43 UTC (rev
1414)
+++ trunk/src/target/debug/input/input.pro 2007-03-19 22:58:17 UTC (rev
1415)
@@ -0,0 +1,27 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Mo Mrz 19 21:47:26 2007
+######################################################################
+
+CONFIG = console debug warn_on link_pkgconfig
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += input.h
+SOURCES += input.c
+
+QMAKE_CFLAGS += -std=c99
+
+PKGCONFIG += glib-2.0
+
+# handle pkgconfig for CFLAGS, CXXFLAGS and LIBS already handled by qmake
+for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) {
+ QMAKE_CFLAGS += $$system(pkg-config --cflags $$PKGCONFIG_LIB)
+}
+
+MOC_DIR = ".moc"
+OBJECTS_DIR = ".obj"
+UI_DIR = ".ui"
+
--- End Message ---