![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package pommed for openSUSE:Factory checked in at Mon Nov 16 17:03:14 CET 2009. -------- --- pommed/pommed.changes 2009-08-01 13:32:07.000000000 +0200 +++ /mounts/work_src_done/STABLE/pommed/pommed.changes 2009-11-11 01:13:23.000000000 +0100 @@ -1,0 +2,16 @@ +Wed Nov 11 01:11:13 CET 2009 - ro@suse.de + +- update to 1.30: + - pommed: fix a crasher in the i2c probe routine on pmac. + - pommed: fix sysfs backlight driver to handle > 3-digit values. +- update to 1.29: + - pommed: add support for newer nvidia backlight driver which + changed the sysfs layout. + - pommed: move VT state checking to pommed, exposed over DBus. + - gpomme: switch to asking pommed for the state of the VT. + - wmpomme: switch to asking pommed for the state of the VT. +- update to 1.28: + - pommed: added support for the MacBookPro5,3 (15" MacBookPro + June 2009) + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- pommed-1.27.tar.bz2 New: ---- pommed-1.30.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pommed.spec ++++++ --- /var/tmp/diff_new_pack.pLeJPo/_old 2009-11-16 16:52:41.000000000 +0100 +++ /var/tmp/diff_new_pack.pLeJPo/_new 2009-11-16 16:52:41.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package pommed (Version 1.27) +# spec file for package pommed (Version 1.30) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -22,7 +22,7 @@ Summary: Apple laptops hotkeys event handler License: GPL v2 only Group: Hardware/Mobile -Version: 1.27 +Version: 1.30 Release: 1 Url: http://technologeek.org/projects/pommed/ %if 0 ++++++ pommed-1.27.tar.bz2 -> pommed-1.30.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/ChangeLog new/pommed-1.30/ChangeLog --- old/pommed-1.27/ChangeLog 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/ChangeLog 2009-10-22 21:25:30.000000000 +0200 @@ -1,6 +1,21 @@ ChangeLog for pommed -------------------- +version 1.30: + - pommed: fix a crasher in the i2c probe routine on pmac. + - pommed: fix sysfs backlight driver to handle > 3-digit values. + +version 1.29: + - pommed: add support for newer nvidia backlight driver which + changed the sysfs layout. + - pommed: move VT state checking to pommed, exposed over DBus. + - gpomme: switch to asking pommed for the state of the VT. + - wmpomme: switch to asking pommed for the state of the VT. + +version 1.28: + - pommed: added support for the MacBookPro5,3 (15" MacBookPro + June 2009) + version 1.27: - pommed: added support for the MacBook5,2 (white MacBook). - pommed: added support for the MacBookPro5,5 (13" MacBookPro June diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/client-common/dbus-client.c new/pommed-1.30/client-common/dbus-client.c --- old/pommed-1.27/client-common/dbus-client.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/client-common/dbus-client.c 2009-10-22 21:25:30.000000000 +0200 @@ -1,7 +1,7 @@ /* * dbus-client.c -- shared DBus client routines for pommed clients * - * Copyright (C) 2006-2007 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2006-2007, 2009 Julien BLACHE <jb@jblache.org> * * 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 @@ -216,6 +216,57 @@ return -1; } + + ret = dbus_connection_send_with_reply(conn, msg, &pending, 250); + if (ret == FALSE) + { + printf("Could not send method call\n"); + + dbus_message_unref(msg); + + return -1; + } + + dbus_connection_flush(conn); + + dbus_message_unref(msg); + + dbus_pending_call_block(pending); + + cb(pending, userdata); + + return 0; +} + +int +mbp_call_video_getvtstate(int vtnum, DBusPendingCallNotifyFunction cb, void *userdata) +{ + DBusMessage *msg; + DBusPendingCall *pending; + + int ret; + + msg = dbus_message_new_method_call("org.pommed", "/org/pommed/video", + "org.pommed.video", "getVTState"); + + if (msg == NULL) + { + printf("Failed to create method call message\n"); + + return -1; + } + + ret = dbus_message_append_args(msg, + DBUS_TYPE_UINT32, &vtnum, + DBUS_TYPE_INVALID); + if (ret == FALSE) + { + printf("Failed to add arguments\n"); + + dbus_message_unref(msg); + + return -1; + } ret = dbus_connection_send_with_reply(conn, msg, &pending, 250); if (ret == FALSE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/client-common/dbus-client.h new/pommed-1.30/client-common/dbus-client.h --- old/pommed-1.27/client-common/dbus-client.h 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/client-common/dbus-client.h 2009-10-22 21:25:30.000000000 +0200 @@ -38,6 +38,9 @@ int mbp_call_audio_getmute(DBusPendingCallNotifyFunction cb, void *userdata); +int +mbp_call_video_getvtstate(int vtnum, DBusPendingCallNotifyFunction cb, void *userdata); + /* Error checking */ int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/client-common/video-client.c new/pommed-1.30/client-common/video-client.c --- old/pommed-1.27/client-common/video-client.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/client-common/video-client.c 2009-10-22 21:25:30.000000000 +0200 @@ -1,7 +1,7 @@ /* * video-client.c -- shared video switch routines for pommed clients * - * Copyright (C) 2007 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2007, 2009 Julien BLACHE <jb@jblache.org> * * Some code below taken from GDM where noted. * @@ -47,7 +47,7 @@ * Get the VT number X is running on * (code taken from GDM, daemon/getvt.c, GPLv2+) */ -static int +int mbp_get_x_vtnum(Display *dpy) { Atom prop; @@ -106,73 +106,18 @@ return num; } -/* - * Determine whether the frontend is running on the active X session - * aka the X session associated to the active VT. - * - * On error, return 1 by default, 0 when the error could mean we're not safe. - */ -static int -mbp_frontend_is_active(Display *dpy) -{ - int vt; - int fd; - char buf[16]; - struct vt_stat vtstat; - - int ret; - - vt = mbp_get_x_vtnum(dpy); - - ret = snprintf(buf, sizeof(buf), "/dev/tty%d", vt); - if ((ret < 0) || (ret >= sizeof(buf))) - return 1; - - /* Try to open the VT our X session is running on */ - fd = open(buf, O_RDWR); - - if ((fd < 0) && (errno == EACCES)) - fd = open(buf, O_RDONLY); - - if ((fd < 0) && (errno == EACCES)) - fd = open(buf, O_WRONLY); - - /* Can't open the VT, this shouldn't happen; maybe X is remote? */ - if (fd < 0) - return 0; - - /* Our VT isn't a tty, WTF?! */ - if (!isatty(fd)) - { - close(fd); - return 0; - } - - /* Get VT state, includes active VT */ - ret = ioctl(fd, VT_GETSTATE, &vtstat); - close(fd); - - if (ret < 0) - return 1; - - return (vt == vtstat.v_active); -} - /* * NOTE: you MUST install a SIGCHLD handler if you use this function */ void -mbp_video_switch(Display *dpy) +mbp_video_switch(void) { struct passwd *pw; char *vsw = NULL; int ret; - if (!mbp_frontend_is_active(dpy)) - return; - if (vsw_user == NULL) { pw = getpwuid(getuid()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/client-common/video-client.h new/pommed-1.30/client-common/video-client.h --- old/pommed-1.27/client-common/video-client.h 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/client-common/video-client.h 2009-10-22 21:25:30.000000000 +0200 @@ -9,8 +9,11 @@ #define VIDEO_SWITCH_USER "/.videoswitch" +int +mbp_get_x_vtnum(Display *dpy); + void -mbp_video_switch(Display *dpy); +mbp_video_switch(void); #endif /* !__MBP_VIDEO_CLIENT_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/.gitignore new/pommed-1.30/.gitignore --- old/pommed-1.27/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/pommed-1.30/.gitignore 2009-10-22 21:25:30.000000000 +0200 @@ -0,0 +1,2 @@ +*~ +*.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/gpomme/.gitignore new/pommed-1.30/gpomme/.gitignore --- old/pommed-1.27/gpomme/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/pommed-1.30/gpomme/.gitignore 2009-10-22 21:25:30.000000000 +0200 @@ -0,0 +1,3 @@ +gpomme +po/*.mo + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/gpomme/gpomme.c new/pommed-1.30/gpomme/gpomme.c --- old/pommed-1.27/gpomme/gpomme.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/gpomme/gpomme.c 2009-10-22 21:25:30.000000000 +0200 @@ -2,7 +2,7 @@ * gpomme - GTK application for use with pommed * * Copyright (C) 2006, 2008 Soeren SONNENBURG <debian@nn7.de> - * Copyright (C) 2006-2008 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2006-2009 Julien BLACHE <jb@jblache.org> * Copyright (C) 2007 daniel g. siegel <dgsiegel@gmail.com> * * Portions of the GTK code below were shamelessly @@ -306,6 +306,36 @@ } +static void +mbp_video_getvtstate_cb(DBusPendingCall *pending, void *status) +{ + DBusMessage *msg; + + msg = dbus_pending_call_steal_reply(pending); + + if (msg == NULL) + { + fprintf(stderr, "Could not steal reply\n"); + + dbus_pending_call_unref(pending); + + return; + } + + dbus_pending_call_unref(pending); + + if (!mbp_dbus_check_error(msg)) + { + dbus_message_get_args(msg, &dbus_err, + DBUS_TYPE_BOOLEAN, (int *)status, + DBUS_TYPE_INVALID); + } + else + *(int *)status = -1; + + dbus_message_unref(msg); +} + static gboolean mbp_dbus_reconnect(gpointer userdata); @@ -384,8 +414,19 @@ } else if (dbus_message_is_signal(msg, "org.pommed.signal.videoSwitch", "videoSwitch")) { + int vtnum; + int vtstate; + int ret; + dpy = GDK_WINDOW_XDISPLAY(GTK_WIDGET(mbp_w.window)->window); - mbp_video_switch(dpy); + + vtnum = mbp_get_x_vtnum(dpy); + + ret = mbp_call_video_getvtstate(vtnum, mbp_video_getvtstate_cb, &vtstate); + if ((ret < 0) || (vtstate < 0)) + fprintf(stderr, "video getVTState call failed !\n"); + else if (vtstate == 1) + mbp_video_switch(); } else if (dbus_message_is_signal(msg, DBUS_INTERFACE_LOCAL, "Disconnected")) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/conffile.c new/pommed-1.30/pommed/conffile.c --- old/pommed-1.27/pommed/conffile.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/conffile.c 2009-10-22 21:25:30.000000000 +0200 @@ -225,7 +225,7 @@ printf(" auto on threshold: %d\n", kbd_cfg.on_thresh); printf(" auto off threshold: %d\n", kbd_cfg.off_thresh); printf(" auto enable: %s\n", (kbd_cfg.auto_on) ? "yes" : "no"); - printf(" idle timer: %d%s\n", (kbd_cfg.idle * KBD_TIMEOUT) / 1000, (kbd_cfg.idle > 0) ? "s" : ""); + printf(" idle timer: %d%s\n", kbd_cfg.idle, (kbd_cfg.idle > 0) ? "s" : ""); printf(" + CD eject:\n"); printf(" enabled: %s\n", (eject_cfg.enabled) ? "yes" : "no"); printf(" device: %s\n", eject_cfg.device); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/dbus.c new/pommed-1.30/pommed/dbus.c --- old/pommed-1.27/pommed/dbus.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/dbus.c 2009-10-22 21:25:30.000000000 +0200 @@ -1,7 +1,7 @@ /* * pommed - Apple laptops hotkeys handler daemon * - * Copyright (C) 2006-2007 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2006-2007, 2009 Julien BLACHE <jb@jblache.org> * * 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 @@ -35,6 +35,7 @@ #include "kbd_backlight.h" #include "ambient.h" #include "audio.h" +#include "video.h" #include "cd_eject.h" @@ -603,6 +604,55 @@ dbus_message_unref(msg); } +static void +process_video_getvtstate_call(DBusMessage *req) +{ + DBusMessage *msg; + + int vtnum; + int vtstate; + int ret; + + logdebug("Got video getVTState call\n"); + + ret = dbus_message_get_args(req, &err, DBUS_TYPE_UINT32, &vtnum, DBUS_TYPE_INVALID); + if (ret == FALSE) + { + logdebug("video getVTState call with no/inappropriate arguments ?!\n"); + + return; + } + + /* Check VT state */ + vtstate = video_vt_active(vtnum); + + msg = dbus_message_new_method_return(req); + + ret = dbus_message_append_args(msg, + DBUS_TYPE_BOOLEAN, &vtstate, + DBUS_TYPE_INVALID); + if (ret == FALSE) + { + logdebug("Failed to add arguments\n"); + + dbus_message_unref(msg); + + return; + } + + ret = dbus_connection_send(conn, msg, NULL); + if (ret == FALSE) + { + logdebug("Could not send video getVTState reply\n"); + + dbus_message_unref(msg); + + return; + } + + dbus_message_unref(msg); +} + static void process_lcd_backlight_step_call(DBusMessage *req, int dir) @@ -765,6 +815,8 @@ process_audio_getvolume_call(msg); else if (dbus_message_is_method_call(msg, "org.pommed.audio", "getMute")) process_audio_getmute_call(msg); + else if (dbus_message_is_method_call(msg, "org.pommed.video", "getVTState")) + process_video_getvtstate_call(msg); // Set methods else if (dbus_message_is_method_call(msg, "org.pommed.lcdBacklight", "levelUp")) process_lcd_backlight_step_call(msg, STEP_UP); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/.gitignore new/pommed-1.30/pommed/.gitignore --- old/pommed-1.27/pommed/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/pommed-1.30/pommed/.gitignore 2009-10-22 21:25:30.000000000 +0200 @@ -0,0 +1,2 @@ +pommed + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/kbd_auto.c new/pommed-1.30/pommed/kbd_auto.c --- old/pommed-1.27/pommed/kbd_auto.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/kbd_auto.c 2009-10-22 21:25:30.000000000 +0200 @@ -143,8 +143,8 @@ kbd_auto_process(int id, uint64_t ticks) { /* Increment keyboard backlight idle timer */ - kbd_bck_info.idle++; - if ((kbd_cfg.idle > 0) && (kbd_bck_info.idle > kbd_cfg.idle)) + kbd_bck_info.idle += KBD_TIMEOUT; + if ((kbd_cfg.idle > 0) && (kbd_bck_info.idle > 1000 * kbd_cfg.idle)) kbd_backlight_inhibit_set(KBD_INHIBIT_IDLE); kbd_backlight_ambient_check(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/mactel/kbd_backlight.c new/pommed-1.30/pommed/mactel/kbd_backlight.c --- old/pommed-1.27/pommed/mactel/kbd_backlight.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/mactel/kbd_backlight.c 2009-10-22 21:25:30.000000000 +0200 @@ -284,7 +284,4 @@ if (kbd_cfg.step > (KBD_BACKLIGHT_MAX / 2)) kbd_cfg.step = KBD_BACKLIGHT_MAX / 2; - - if (kbd_cfg.idle > 0) - kbd_cfg.idle = (kbd_cfg.idle * 1000) / KBD_TIMEOUT; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/pmac/kbd_backlight.c new/pommed-1.30/pommed/pmac/kbd_backlight.c --- old/pommed-1.27/pommed/pmac/kbd_backlight.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/pmac/kbd_backlight.c 2009-10-22 21:25:30.000000000 +0200 @@ -379,9 +379,6 @@ if (kbd_cfg.step > (KBD_BACKLIGHT_MAX / 2)) kbd_cfg.step = KBD_BACKLIGHT_MAX / 2; - - if (kbd_cfg.idle > 0) - kbd_cfg.idle = (kbd_cfg.idle * 1000) / KBD_TIMEOUT; } @@ -407,10 +404,20 @@ } fp = fopen(buf, "r"); - if ((fp == NULL) && (errno != ENOENT)) + if (fp == NULL) { - logmsg(LOG_ERR, "Error: i2c device probe: cannot open %s: %s", buf, strerror(errno)); - continue; + if (errno != ENOENT) + { + logmsg(LOG_ERR, "Error: i2c device probe: cannot open %s: %s", buf, strerror(errno)); + continue; + } + else + { + logmsg(LOG_ERR, "Error: i2c device probe: i2c device not found, is i2c-dev loaded?"); + + i2c_bus = 256; + break; + } } ret = fread(buf, 1, PATH_MAX - 1, fp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/pommed.c new/pommed-1.30/pommed/pommed.c --- old/pommed-1.27/pommed/pommed.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/pommed.c 2009-10-22 21:25:30.000000000 +0200 @@ -277,6 +277,7 @@ { /* MacBookPro5,1 (15" & 17", Core2 Duo, October 2008) * MacBookPro5,2 (17" June 2009) + * MacBookPro5,3 (15" June 2009) * MacBookPro5,5 (13" June 2009) */ .type = MACHINE_MACBOOKPRO_5, .lcd_backlight_probe = mbp_sysfs_backlight_probe, @@ -677,6 +678,7 @@ * MacBook Pro 13" (June 2009) */ else if ((strcmp(buf, "MacBookPro5,1") == 0) || (strcmp(buf, "MacBookPro5,2") == 0) + || (strcmp(buf, "MacBookPro5,3") == 0) || (strcmp(buf, "MacBookPro5,5") == 0)) ret = MACHINE_MACBOOKPRO_5; /* Core Duo MacBook (May 2006) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/pommed.h new/pommed-1.30/pommed/pommed.h --- old/pommed-1.27/pommed/pommed.h 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/pommed.h 2009-10-22 21:25:30.000000000 +0200 @@ -6,7 +6,7 @@ #define __POMMED_H__ -#define M_VERSION "1.27" +#define M_VERSION "1.30" extern int debug; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/sysfs_backlight.c new/pommed-1.30/pommed/sysfs_backlight.c --- old/pommed-1.27/pommed/sysfs_backlight.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/sysfs_backlight.c 2009-10-22 21:25:30.000000000 +0200 @@ -42,6 +42,7 @@ SYSFS_DRIVER_NVIDIA, #else SYSFS_DRIVER_MBP, + SYSFS_DRIVER_NVIDIA, #endif }; @@ -59,6 +60,7 @@ "/sys/class/backlight/nvidiabl0/actual_brightness", #else "/sys/class/backlight/mbp_backlight/actual_brightness", + "/sys/class/backlight/nvidia_backlight/actual_brightness", #endif }; @@ -72,6 +74,7 @@ "/sys/class/backlight/nvidiabl0/brightness", #else "/sys/class/backlight/mbp_backlight/brightness", + "/sys/class/backlight/nvidia_backlight/brightness", #endif }; @@ -85,6 +88,7 @@ "/sys/class/backlight/nvidiabl0/max_brightness", #else "/sys/class/backlight/mbp_backlight/max_brightness", + "/sys/class/backlight/nvidia_backlight/max_brightness", #endif }; @@ -97,7 +101,7 @@ { int fd; int n; - char buffer[4]; + char buffer[8]; if (bck_driver == SYSFS_DRIVER_NONE) return 0; @@ -110,7 +114,8 @@ return 0; } - n = read(fd, buffer, sizeof(buffer) -1); + memset(buffer, 0, sizeof(buffer)); + n = read(fd, buffer, sizeof(buffer) - 1); if (n < 1) { logmsg(LOG_WARNING, "Could not read sysfs actual_brightness node"); @@ -128,7 +133,7 @@ { int fd; int n; - char buffer[4]; + char buffer[8]; if (bck_driver == SYSFS_DRIVER_NONE) return 0; @@ -141,7 +146,8 @@ return 0; } - n = read(fd, buffer, sizeof(buffer) -1); + memset(buffer, 0, sizeof(buffer)); + n = read(fd, buffer, sizeof(buffer) - 1); if (n < 1) { logmsg(LOG_WARNING, "Could not read sysfs max_brightness node"); @@ -395,6 +401,11 @@ if (ret == 0) return 0; + + ret = sysfs_backlight_probe(SYSFS_DRIVER_NVIDIA); + + if (ret == 0) + return 0; /* Probe failed, wire up native driver instead */ switch (mops->type) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/video.c new/pommed-1.30/pommed/video.c --- old/pommed-1.27/pommed/video.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/video.c 2009-10-22 21:25:30.000000000 +0200 @@ -1,7 +1,7 @@ /* * pommed - Apple laptops hotkeys handler daemon * - * Copyright (C) 2007 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2007, 2009 Julien BLACHE <jb@jblache.org> * * 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 @@ -19,6 +19,18 @@ #include <stdio.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/ioctl.h> + +#include <errno.h> + +#include <linux/vt.h> + #include <syslog.h> #include "pommed.h" @@ -31,3 +43,46 @@ { mbpdbus_send_video_switch(); } + +int +video_vt_active(int vt) +{ + int fd; + char buf[16]; + struct vt_stat vtstat; + + int ret; + + ret = snprintf(buf, sizeof(buf), "/dev/tty%d", vt); + if ((ret < 0) || (ret >= sizeof(buf))) + return 1; + + /* Try to open the VT the client's X session is running on */ + fd = open(buf, O_RDWR); + + if ((fd < 0) && (errno == EACCES)) + fd = open(buf, O_RDONLY); + + if ((fd < 0) && (errno == EACCES)) + fd = open(buf, O_WRONLY); + + /* Can't open the VT, this shouldn't happen; maybe X is remote? */ + if (fd < 0) + return 0; + + /* The VT isn't a tty, WTF?! */ + if (!isatty(fd)) + { + close(fd); + return 0; + } + + /* Get VT state, includes currently-active VT number */ + ret = ioctl(fd, VT_GETSTATE, &vtstat); + close(fd); + + if (ret < 0) + return 1; + + return (vt == vtstat.v_active); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/pommed/video.h new/pommed-1.30/pommed/video.h --- old/pommed-1.27/pommed/video.h 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/pommed/video.h 2009-10-22 21:25:30.000000000 +0200 @@ -9,6 +9,9 @@ void video_switch(void); +int +video_vt_active(int vt); + #endif /* !__VIDEO_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/README new/pommed-1.30/README --- old/pommed-1.27/README 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/README 2009-10-22 21:25:30.000000000 +0200 @@ -26,7 +26,7 @@ * MacBook Pro Core Duo 17" (April 2006) * MacBook Pro Core2 Duo 15" (October 2006, June 2007, February 2008, October 2008) * MacBook Pro Core2 Duo 17" (October 2006, June 2007, February 2008, October 2008) - * MacBook Pro 13", 17" (June 2009) + * MacBook Pro 13", 15", 17" (June 2009) * MacBook Core Duo (May 2006) * MacBook Core2 Duo (November 2006 & May 2007) * MacBook Core2 Duo Santa Rosa (November 2007) @@ -67,6 +67,15 @@ should take care of this. +Keyboard backlight on PowerMac machines +--------------------------------------- + +The keyboard backlight on PowerMac machines (except the very first ones) is +driven through i2c. You need the i2c-dev kernel module loaded on your system +for pommed to work properly; you can add i2c-dev to /etc/modules to have it +loaded automatically at system startup. + + Beeper feature -------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/wmpomme/.gitignore new/pommed-1.30/wmpomme/.gitignore --- old/pommed-1.27/wmpomme/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/pommed-1.30/wmpomme/.gitignore 2009-10-22 21:25:30.000000000 +0200 @@ -0,0 +1,2 @@ +wmpomme + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pommed-1.27/wmpomme/wmpomme.c new/pommed-1.30/wmpomme/wmpomme.c --- old/pommed-1.27/wmpomme/wmpomme.c 2009-08-01 10:24:47.000000000 +0200 +++ new/pommed-1.30/wmpomme/wmpomme.c 2009-10-22 21:25:30.000000000 +0200 @@ -1,7 +1,7 @@ /* * wmpomme -- WindowMaker dockapp for use with pommed * - * Copyright (C) 2006-2008 Julien BLACHE <jb@jblache.org> + * Copyright (C) 2006-2009 Julien BLACHE <jb@jblache.org> * * Based on wmwave by Carsten Schuermann <carsten@schuermann.org> * wmwave derived from: @@ -129,6 +129,10 @@ return 0; } +/* Forward */ +void +wmmbp_video_getvtstate_cb(DBusPendingCall *pending, void *status); + void mbp_dbus_listen(void) { @@ -207,7 +211,17 @@ } else if (dbus_message_is_signal(msg, "org.pommed.signal.videoSwitch", "videoSwitch")) { - mbp_video_switch(display); + int vtnum; + int vtstate; + int ret; + + vtnum = mbp_get_x_vtnum(display); + + ret = mbp_call_video_getvtstate(vtnum, wmmbp_video_getvtstate_cb, &vtstate); + if ((ret < 0) || (vtstate < 0)) + fprintf(stderr, "video getVTState call failed !\n"); + else if (vtstate == 1) + mbp_video_switch(); } else if (dbus_message_is_signal(msg, DBUS_INTERFACE_LOCAL, "Disconnected")) { @@ -379,6 +393,36 @@ DBUS_TYPE_INVALID); } else + *(int *)status = -1; + + dbus_message_unref(msg); +} + +void +wmmbp_video_getvtstate_cb(DBusPendingCall *pending, void *status) +{ + DBusMessage *msg; + + msg = dbus_pending_call_steal_reply(pending); + + if (msg == NULL) + { + fprintf(stderr, "Could not steal reply\n"); + + dbus_pending_call_unref(pending); + + return; + } + + dbus_pending_call_unref(pending); + + if (!mbp_dbus_check_error(msg)) + { + dbus_message_get_args(msg, &dbus_err, + DBUS_TYPE_BOOLEAN, (int *)status, + DBUS_TYPE_INVALID); + } + else *(int *)status = -1; dbus_message_unref(msg); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de