[PATCH 2/6] update usage of input.h definitions and assume their presence

Guillem Jover guillem.jover at nokia.com
Fri Oct 31 17:28:48 PDT 2008


Use SW_RFKILL_ALL instead of deprecated SW_RADIO. Remove conditional
KEY_ and SW_ defnition usage.
---
 hald/linux/addons/addon-input.c  |   26 +-------------------------
 hald/linux/device.c              |    4 +---
 hald/linux/probing/probe-input.c |    4 +---
 3 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/hald/linux/addons/addon-input.c b/hald/linux/addons/addon-input.c
index ec3e7ab..b2ed992 100644
--- a/hald/linux/addons/addon-input.c
+++ b/hald/linux/addons/addon-input.c
@@ -145,37 +145,15 @@ static char *key_name[KEY_MAX + 1] = {
 	[KEY_MUTE] = "mute",
 	[KEY_VOLUMEDOWN] = "volume-down",
 	[KEY_VOLUMEUP] = "volume-up",
-#ifndef KEY_SWITCHVIDEOMODE
-#define KEY_SWITCHVIDEOMODE	227
-#endif
 	[KEY_SWITCHVIDEOMODE] = "switch-videomode",
-#ifndef KEY_KBDILLUMTOGGLE
-#define KEY_KBDILLUMTOGGLE	228
-#endif
 	[KEY_KBDILLUMTOGGLE] = "kbd-illum-toggle",
-#ifndef KEY_KBDILLUMDOWN
-#define KEY_KBDILLUMDOWN	229
-#endif
 	[KEY_KBDILLUMDOWN] = "kbd-illum-down",
-#ifndef KEY_KBDILLUMUP
-#define KEY_KBDILLUMUP		230
-#endif
 	[KEY_KBDILLUMUP] = "kbd-illum-up",
-#ifndef KEY_BATTERY
-#define KEY_BATTERY 236
-#endif
 	[KEY_BATTERY] = "battery",
-#ifndef KEY_BLUETOOTH
-#define KEY_BLUETOOTH 237
-#endif
 	[KEY_BLUETOOTH] = "bluetooth",
-#ifndef KEY_WLAN
-#define KEY_WLAN 238
-#endif
 	[KEY_WLAN] = "wlan"
 };
 
-
 /* we must use this kernel-compatible implementation */
 #define BITS_PER_LONG (sizeof(long) * 8)
 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
@@ -245,11 +223,9 @@ event_io (GIOChannel *channel, GIOCondition condition, gpointer data)
 			case SW_HEADPHONE_INSERT:
 				name = "headphone_insert";
 				break;
-#ifdef SW_RADIO
-			case SW_RADIO:
+			case SW_RFKILL_ALL:
 				name = "radio";
 				break;
-#endif
 			}
 			if (name != NULL) {
 				long bitmask[NBITS(SW_MAX)];
diff --git a/hald/linux/device.c b/hald/linux/device.c
index c1931a6..ffa68b4 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1028,10 +1028,8 @@ input_test_switch (HalDevice *d, const char *sysfs_path)
 			hal_device_property_set_string (d, "button.type", "tablet_mode");
 		} else if (test_bit (SW_HEADPHONE_INSERT, bitmask)) {
 			hal_device_property_set_string (d, "button.type", "headphone_insert");
-#ifdef SW_RADIO
-		} else if (test_bit (SW_RADIO, bitmask)) {
+		} else if (test_bit (SW_RFKILL_ALL, bitmask)) {
 			hal_device_property_set_string (d, "button.type", "radio");
-#endif
 		}
 	}
 
diff --git a/hald/linux/probing/probe-input.c b/hald/linux/probing/probe-input.c
index 8333800..e860b5e 100644
--- a/hald/linux/probing/probe-input.c
+++ b/hald/linux/probing/probe-input.c
@@ -77,10 +77,8 @@ main (int argc, char *argv[])
 		sw = SW_TABLET_MODE;
 	else if (strcmp (button_type, "headphone_insert") == 0)
 		sw = SW_HEADPHONE_INSERT;
-#ifdef SW_RADIO
 	else if (strcmp (button_type, "radio") == 0)
-		sw = SW_RADIO;
-#endif
+		sw = SW_RFKILL_ALL;
 	else
 		goto out;
 
-- 
1.6.0.2



More information about the hal mailing list