Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2009 12:11:22 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        freebsd-gnome@FreeBSD.org
Cc:        freebsd-x11@FreeBSD.org
Subject:   [PATCH] sysutils/hal fix for sysmouse(4) and ACPI
Message-ID:  <200902041211.32033.jkim@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--Boundary-00=_ExciJIfIK+hBPUd
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

This patch does two things:

- Do not allow openning /dev/sysmouse multiple times.  When there are 
multiple instances of moused(8) and Xorg mouse driver 
opens /dev/sysmouse multiple times, Xorg server gets confused badly, 
e.g., losing input events, waiting for already processed events, etc.
- Really fix laptop brightness control.  The previous commit didn't 
fix IBM and Sony laptops.  Pointyhat to me, again.

Please review.

Thanks,

Jung-uk Kim

--Boundary-00=_ExciJIfIK+hBPUd
Content-Type: text/plain;
  charset="iso-8859-1";
  name="hal.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="hal.diff"

--- sysutils/hal/Makefile	2 Feb 2009 22:33:22 -0000	1.47
+++ sysutils/hal/Makefile	4 Feb 2009 16:51:34 -0000
@@ -8,7 +8,7 @@
 
 PORTNAME=	hal
 DISTVERSION=	0.5.11
-PORTREVISION=	16
+PORTREVISION=	17
 CATEGORIES=	sysutils
 MASTER_SITES=	http://hal.freedesktop.org/releases/
 
--- sysutils/hal/files/patch-hald_freebsd_hf-acpi.c	3 Feb 2009 01:54:59 -0000	1.2
+++ sysutils/hal/files/patch-hald_freebsd_hf-acpi.c	4 Feb 2009 16:51:36 -0000
@@ -1,6 +1,50 @@
 --- hald/freebsd/hf-acpi.c.orig	2008-05-07 19:23:59.000000000 -0400
-+++ hald/freebsd/hf-acpi.c	2009-02-02 20:32:05.000000000 -0500
-@@ -105,6 +105,9 @@
++++ hald/freebsd/hf-acpi.c	2009-02-04 11:32:27.000000000 -0500
+@@ -54,6 +54,7 @@
+ static const struct laptop_panel_type {
+   char *access;
+   char *name;
++  char *get_sysctl;
+   char *max_sysctl;
+   int max_levels;
+ #define HF_ACPI_IBM_MAX_LEVELS		8
+@@ -64,17 +65,29 @@
+ #define HF_ACPI_FUJITSU_MAX_LEVELS	8
+   /* NOTE: Each new type must also be added to hf-devtree.c */
+ } laptop_panel_types[] = {
+-  { "ibm",		"IBM",		NULL,
++  { "ibm",		"IBM",
++    "dev.acpi_ibm.0.lcd_brightness",
++    NULL,
+     HF_ACPI_IBM_MAX_LEVELS },
+-  { "toshiba",		"Toshiba",	NULL,
++  { "toshiba",		"Toshiba",
++    "hw.acpi.toshiba.lcd_brightness",
++    NULL,
+     HF_ACPI_TOSHIBA_MAX_LEVELS },
+-  { "sony",		"Sony",		NULL,
++  { "sony",		"Sony",
++    "dev.acpi_sony.0.brightness",
++    NULL,
+     HF_ACPI_SONY_MAX_LEVELS },
+-  { "panasonic",	"Panasonic",	"hw.acpi.panasonic.lcd_brightness_max",
++  { "panasonic",	"Panasonic",
++    "hw.acpi.panasonic.lcd_brightness",
++    "hw.acpi.panasonic.lcd_brightness_max",
+     HF_ACPI_PANASONIC_MAX_LEVELS },
+-  { "asus",		"Asus",		NULL,
++  { "asus",		"Asus",
++    "hw.acpi.asus.lcd_brightness",
++    NULL,
+     HF_ACPI_ASUS_MAX_LEVELS },
+-  { "fujitsu",		"Fujitsu",	NULL,
++  { "fujitsu",		"Fujitsu",
++    "hw.acpi.fujitsu.lcd_brightness",
++    NULL,
+     HF_ACPI_FUJITSU_MAX_LEVELS }
+ };
+ 
+@@ -105,6 +118,9 @@
    gboolean ispresent;
    union acpi_battery_ioctl_arg battif, battst, battinfo;
  
@@ -10,25 +54,31 @@
    battif.unit = battst.unit = battinfo.unit =
      hal_device_property_get_int(device, "freebsd.unit");
  
-@@ -500,10 +503,17 @@
-                           const char *max_sysctl, const char *access,
-                           const char *name)
+@@ -497,13 +513,15 @@
+ 
+ static HalDevice *
+ hf_acpi_laptop_panel_new (HalDevice *parent, int max_levels,
+-                          const char *max_sysctl, const char *access,
+-                          const char *name)
++                          const char *get_sysctl, const char *max_sysctl,
++                          const char *access, const char *name)
  {
-+  char *brightness;
    HalDevice *device;
  
    g_return_val_if_fail(HAL_IS_DEVICE(parent), NULL);
  
-+  if (! strcmp(access, "sony"))
-+    brightness = "brightness";
-+  else
-+    brightness = "lcd_brightness";
-+  if (! hf_has_sysctl("hw.acpi.%s.%s", access, brightness))
++  if (get_sysctl == NULL || ! hf_has_sysctl(get_sysctl))
 +    return NULL;
    device = hf_device_new(parent);
  
    hf_device_property_set_string_printf(device, "info.product", "Laptop Panel (%s)", name);
-@@ -597,7 +607,8 @@
+@@ -593,11 +611,13 @@
+               HalDevice *panel_device;
+ 
+ 	      panel_device = hf_acpi_laptop_panel_new(parent,
+-                                                      laptop_panel_types[i].max_levels,
++						      laptop_panel_types[i].max_levels,
++						      laptop_panel_types[i].get_sysctl,
  						      laptop_panel_types[i].max_sysctl,
  						      laptop_panel_types[i].access,
  						      laptop_panel_types[i].name);
--- sysutils/hal/files/patch-hald_freebsd_probing_probe-mouse.c	26 Jan 2009 17:55:44 -0000	1.1
+++ sysutils/hal/files/patch-hald_freebsd_probing_probe-mouse.c	4 Feb 2009 16:51:36 -0000
@@ -1,6 +1,6 @@
---- hald/freebsd/probing/probe-mouse.c.orig	2009-01-25 16:54:29.000000000 -0500
-+++ hald/freebsd/probing/probe-mouse.c	2009-01-25 18:40:04.000000000 -0500
-@@ -0,0 +1,301 @@
+--- hald/freebsd/probing/probe-mouse.c.orig	2009-02-04 11:00:00.000000000 -0500
++++ hald/freebsd/probing/probe-mouse.c	2009-02-04 11:04:43.000000000 -0500
+@@ -0,0 +1,312 @@
 +/***************************************************************************
 + * CVSID: $Id$
 + *
@@ -227,7 +227,9 @@
 +probe_mouse (const char *device_file)
 +{
 +  gboolean found;
++  char **udis;
 +  char *driver;
++  int num_udis;
 +
 +  driver = libhal_device_get_property_string(hfp_ctx, hfp_udi,
 +                                             "input.x11_driver", &hfp_error);
@@ -255,10 +257,19 @@
 +      found = device_opened_by_proc(MOUSED_DEVICE, XORG_PROC_NAME);
 +      if (! found)
 +        {
-+          libhal_device_set_property_string(hfp_ctx, hfp_udi,
-+			                    "input.x11_driver",
-+                                            MOUSE_DRIVER, &hfp_error);
++	  udis = libhal_manager_find_device_string_match(hfp_ctx,
++							 "input.device",
++							 MOUSED_DEVICE,
++							 &num_udis,
++							 &hfp_error);
 +	  dbus_error_free(&hfp_error);
++	  if (num_udis > 0 && udis != NULL && !strcmp(udis[0], hfp_udi)) {
++	    libhal_device_set_property_string(hfp_ctx, hfp_udi,
++					      "input.x11_driver",
++					      MOUSE_DRIVER, &hfp_error);
++	    dbus_error_free(&hfp_error);
++	    libhal_free_string_array(udis);
++	  }
 +	}
 +      else if (driver)
 +        {

--Boundary-00=_ExciJIfIK+hBPUd--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902041211.32033.jkim>