By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1597
Collapse All | Expand All

(-)a/tdecore/tdehw/hwlibdaemons/dbus/org.trinitydesktop.hardwarecontrol.conf (-2 / +6 lines)
Lines 16-24 Link Here
16
16
17
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
17
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
18
           send_interface="org.freedesktop.DBus.Properties"/>
18
           send_interface="org.freedesktop.DBus.Properties"/>
19
    <allow send_destination="org.trinitydesktop.hardwarecontrol.Brightness"
20
           send_interface="org.freedesktop.DBus.Properties"/>
19
    <allow send_destination="org.trinitydesktop.hardwarecontrol.CPUGovernor"
21
    <allow send_destination="org.trinitydesktop.hardwarecontrol.CPUGovernor"
20
           send_interface="org.freedesktop.DBus.Properties"/>
22
           send_interface="org.freedesktop.DBus.Properties"/>
21
    <allow send_destination="org.trinitydesktop.hardwarecontrol.Brightness"
23
    <allow send_destination="org.trinitydesktop.hardwarecontrol.InputEvents"
22
           send_interface="org.freedesktop.DBus.Properties"/>
24
           send_interface="org.freedesktop.DBus.Properties"/>
23
    <allow send_destination="org.trinitydesktop.hardwarecontrol.Power"
25
    <allow send_destination="org.trinitydesktop.hardwarecontrol.Power"
24
           send_interface="org.freedesktop.DBus.Properties"/>
26
           send_interface="org.freedesktop.DBus.Properties"/>
Lines 26-34 Link Here
26
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
28
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
27
           send_interface="org.trinitydesktop.hardwarecontrol"/>
29
           send_interface="org.trinitydesktop.hardwarecontrol"/>
28
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
30
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
31
           send_interface="org.trinitydesktop.hardwarecontrol.Brightness"/>
32
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
29
           send_interface="org.trinitydesktop.hardwarecontrol.CPUGovernor"/>
33
           send_interface="org.trinitydesktop.hardwarecontrol.CPUGovernor"/>
30
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
34
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
31
           send_interface="org.trinitydesktop.hardwarecontrol.Brightness"/>
35
           send_interface="org.trinitydesktop.hardwarecontrol.InputEvents"/>
32
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
36
    <allow send_destination="org.trinitydesktop.hardwarecontrol"
33
           send_interface="org.trinitydesktop.hardwarecontrol.Power"/>
37
           send_interface="org.trinitydesktop.hardwarecontrol.Power"/>
34
  </policy>
38
  </policy>
(-)a/tdecore/tdehw/hwlibdaemons/dbus/tde_dbus_hardwarecontrol.c (-9 / +158 lines)
Lines 5-10 Link Here
5
#include <stdio.h>
5
#include <stdio.h>
6
#include <stdlib.h>
6
#include <stdlib.h>
7
#include <string.h>
7
#include <string.h>
8
#include <fcntl.h>
9
10
// Input devices
11
#include <linux/input.h>
12
13
#define BITS_PER_LONG (sizeof(long) * 8)
14
#define NUM_BITS(x) ((((x) - 1) / BITS_PER_LONG) + 1)
8
15
9
void reply_Bool(DBusMessage* msg, DBusConnection* conn, int value) {
16
void reply_Bool(DBusMessage* msg, DBusConnection* conn, int value) {
10
	DBusMessage* reply;
17
	DBusMessage* reply;
Lines 177-183 void reply_CanSetBrightness(DBusMessage* msg, DBusConnection* conn) { Link Here
177
	const char* member = dbus_message_get_member(msg);
184
	const char* member = dbus_message_get_member(msg);
178
	char* rawpath;
185
	char* rawpath;
179
	char* safepath;
186
	char* safepath;
180
	char path[256];
181
187
182
	// read the arguments
188
	// read the arguments
183
	if (!dbus_message_iter_init(msg, &args)) {
189
	if (!dbus_message_iter_init(msg, &args)) {
Lines 211-217 void reply_SetBrightness(DBusMessage* msg, DBusConnection* conn) { Link Here
211
	char* rawpath;
217
	char* rawpath;
212
	char* safepath;
218
	char* safepath;
213
	char* brightness;
219
	char* brightness;
214
	char path[256];
215
220
216
	// read the arguments
221
	// read the arguments
217
	if (!dbus_message_iter_init(msg, &args)) {
222
	if (!dbus_message_iter_init(msg, &args)) {
Lines 266-272 void reply_CanSetPower(DBusMessage* msg, DBusConnection* conn, char* state) { Link Here
266
			char *line = NULL;
271
			char *line = NULL;
267
			size_t len = 0;
272
			size_t len = 0;
268
			ssize_t read = getline(&line, &len, node);
273
			ssize_t read = getline(&line, &len, node);
269
			if (line) {
274
			if (read > 0 && line) {
270
				method = strstr(line, state) != NULL;
275
				method = strstr(line, state) != NULL;
271
				free(line);
276
				free(line);
272
			}
277
			}
Lines 317-322 void reply_SetHibernationMethod(DBusMessage* msg, DBusConnection* conn) { Link Here
317
	}
322
	}
318
}
323
}
319
324
325
void reply_InputEventsGetSwitches(DBusMessage* msg, DBusConnection* conn, bool active) {
326
	DBusMessage* reply;
327
	DBusMessageIter args, arrayIter;
328
	const char* member = dbus_message_get_member(msg);
329
	dbus_uint32_t serial = 0;
330
	char* rawpath;
331
	char* safepath;
332
	int fd, r;
333
	unsigned long switches[NUM_BITS(EV_CNT)];
334
335
	// read the arguments
336
	if (!dbus_message_iter_init(msg, &args)) {
337
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: no argument supplied\n", member);
338
	}
339
	else if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)) {
340
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: argument not string\n", member);
341
	}
342
	else {
343
		dbus_message_iter_get_basic(&args, &rawpath);
344
	}
345
346
	safepath = realpath(rawpath, NULL);
347
348
	if (safepath &&
349
		(strstr(safepath, "/dev/input/event") == safepath)
350
		) {
351
352
		fd = open(safepath, O_RDONLY);
353
		if( active ) {
354
			r = ioctl(fd, EVIOCGSW(sizeof(switches)), switches);
355
		}
356
		else {
357
			r = ioctl(fd, EVIOCGBIT(EV_SW, EV_CNT), switches);
358
		}
359
		if( r > 0 ) {
360
			dbus_uint32_t dSwitches[NUM_BITS(EV_CNT)];
361
			dbus_uint32_t *dSwitchesP = dSwitches;
362
			int i;
363
364
			// create a reply from the message
365
			reply = dbus_message_new_method_return(msg);
366
367
			// add the arguments to the reply
368
			for( i = 0; i < sizeof(switches)/sizeof(switches[0]); i++ ) {
369
				dSwitches[i] = switches[i];
370
			}
371
			dbus_message_iter_init_append(reply, &args);
372
			if (!dbus_message_iter_open_container(&args, DBUS_TYPE_ARRAY, "u", &arrayIter)) {
373
				fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_message_iter_open_container failed\n", member);
374
				return;
375
			}
376
			if( !dbus_message_iter_append_fixed_array(&arrayIter, DBUS_TYPE_UINT32,
377
					&dSwitchesP, sizeof(switches)/sizeof(switches[0])) ) {
378
				fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_message_iter_append_fixed_array failed\n", member);
379
				return;
380
			}
381
			if (!dbus_message_iter_close_container(&args, &arrayIter)) {
382
				fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_message_iter_close_container failed\n", member);
383
				return;
384
			}
385
		}
386
		else {
387
			// create a reply from the message
388
			reply = dbus_message_new_error_printf(msg,
389
				"org.freedesktop.DBus.Error.NotSupported",
390
				"Event device \"%s\" not support EV_SW ioctl",
391
				safepath);
392
		}
393
		close(fd);
394
	}
395
	else {
396
		// create a reply from the message
397
		reply = dbus_message_new_error_printf(msg,
398
			"org.freedesktop.DBus.Error.InvalidArgs",
399
			"Event device \"%s\" is invalid",
400
			rawpath);
401
	}
402
403
	// send the reply && flush the connection
404
	if (!dbus_connection_send(conn, reply, &serial)) {
405
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_connection_send failed\n", member);
406
		return;
407
	}
408
	dbus_connection_flush(conn);
409
410
	// free the reply
411
	dbus_message_unref(reply);
412
413
	// free safepath
414
	free(safepath);
415
}
416
320
void signal_NameAcquired(DBusMessage* msg) {
417
void signal_NameAcquired(DBusMessage* msg) {
321
	DBusMessageIter args;
418
	DBusMessageIter args;
322
	char *name = NULL;
419
	char *name = NULL;
Lines 354-359 void reply_Introspect(DBusMessage* msg, DBusConnection* conn) { Link Here
354
	}
451
	}
355
	else if(strcmp("/org/trinitydesktop/hardwarecontrol", path) == 0) {
452
	else if(strcmp("/org/trinitydesktop/hardwarecontrol", path) == 0) {
356
		strncat(data,
453
		strncat(data,
454
			"  <interface name=\"org.trinitydesktop.hardwarecontrol.Brightness\">\n"
455
			"    <method name=\"CanSetBrightness\">\n"
456
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
457
			"      <arg name=\"value\" direction=\"out\" type=\"b\" />\n"
458
			"    </method>\n"
459
			"    <method name=\"SetBrightness\">\n"
460
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
461
			"      <arg name=\"brightness\" direction=\"in\" type=\"s\" />\n"
462
			"      <arg name=\"value\" direction=\"out\" type=\"b\" />\n"
463
			"    </method>\n"
464
			"  </interface>\n",
465
			size-strlen(data));
466
		strncat(data,
357
			"  <interface name=\"org.trinitydesktop.hardwarecontrol.CPUGovernor\">\n"
467
			"  <interface name=\"org.trinitydesktop.hardwarecontrol.CPUGovernor\">\n"
358
			"    <method name=\"CanSetCPUGovernor\">\n"
468
			"    <method name=\"CanSetCPUGovernor\">\n"
359
			"      <arg name=\"cpu\" direction=\"in\" type=\"i\" />\n"
469
			"      <arg name=\"cpu\" direction=\"in\" type=\"i\" />\n"
Lines 367-381 void reply_Introspect(DBusMessage* msg, DBusConnection* conn) { Link Here
367
			"  </interface>\n",
477
			"  </interface>\n",
368
			size-strlen(data));
478
			size-strlen(data));
369
		strncat(data,
479
		strncat(data,
370
			"  <interface name=\"org.trinitydesktop.hardwarecontrol.Brightness\">\n"
480
			"  <interface name=\"org.trinitydesktop.hardwarecontrol.InputEvents\">\n"
371
			"    <method name=\"CanSetBrightness\">\n"
481
			"    <method name=\"GetProvidedSwitches\">\n"
372
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
482
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
373
			"      <arg name=\"value\" direction=\"out\" type=\"b\" />\n"
483
			"      <arg name=\"value\" direction=\"out\" type=\"au\" />\n"
374
			"    </method>\n"
484
			"    </method>\n"
375
			"    <method name=\"SetBrightness\">\n"
485
			"    <method name=\"GetActiveSwitches\">\n"
376
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
486
			"      <arg name=\"device\" direction=\"in\" type=\"s\" />\n"
377
			"      <arg name=\"brightness\" direction=\"in\" type=\"s\" />\n"
487
			"      <arg name=\"value\" direction=\"out\" type=\"au\" />\n"
378
			"      <arg name=\"value\" direction=\"out\" type=\"b\" />\n"
379
			"    </method>\n"
488
			"    </method>\n"
380
			"  </interface>\n",
489
			"  </interface>\n",
381
			size-strlen(data));
490
			size-strlen(data));
Lines 439-444 void reply_Introspect(DBusMessage* msg, DBusConnection* conn) { Link Here
439
	free((void*)data);
548
	free((void*)data);
440
}
549
}
441
550
551
void reply_PropertiesGetAll(DBusMessage* msg, DBusConnection* conn) {
552
	DBusMessage* reply;
553
	DBusMessageIter args, arrayIter;
554
	const char* member = dbus_message_get_member(msg);
555
	dbus_uint32_t serial = 0;
556
557
	// create a reply from the message
558
	reply = dbus_message_new_method_return(msg);
559
560
	// add the arguments to the reply
561
	dbus_message_iter_init_append(reply, &args);
562
	if (!dbus_message_iter_open_container(&args, DBUS_TYPE_ARRAY, "sv", &arrayIter)) {
563
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_message_iter_open_container failed\n", member);
564
		return;
565
	}
566
	if (!dbus_message_iter_close_container(&args, &arrayIter)) {
567
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_message_iter_close_container failed\n", member);
568
		return;
569
	}
570
571
	// send the reply && flush the connection
572
	if (!dbus_connection_send(conn, reply, &serial)) {
573
		fprintf(stderr, "[tde_dbus_hardwarecontrol] %s: dbus_connection_send failed\n", member);
574
		return;
575
	}
576
	dbus_connection_flush(conn);
577
578
	// free the reply
579
	dbus_message_unref(reply);
580
}
581
442
void error_UnknownMessage(DBusMessage* msg, DBusConnection* conn) {
582
void error_UnknownMessage(DBusMessage* msg, DBusConnection* conn) {
443
	DBusMessage* reply;
583
	DBusMessage* reply;
444
	dbus_uint32_t serial = 0;
584
	dbus_uint32_t serial = 0;
Lines 555-566 void listen() { Link Here
555
		else if (dbus_message_is_method_call(msg, "org.trinitydesktop.hardwarecontrol.Power", "SetHibernationMethod")) {
695
		else if (dbus_message_is_method_call(msg, "org.trinitydesktop.hardwarecontrol.Power", "SetHibernationMethod")) {
556
			reply_SetHibernationMethod(msg, conn);
696
			reply_SetHibernationMethod(msg, conn);
557
		}
697
		}
698
		else if (dbus_message_is_method_call(msg, "org.trinitydesktop.hardwarecontrol.InputEvents", "GetProvidedSwitches")) {
699
			reply_InputEventsGetSwitches(msg, conn, false);
700
		}
701
		else if (dbus_message_is_method_call(msg, "org.trinitydesktop.hardwarecontrol.InputEvents", "GetActiveSwitches")) {
702
			reply_InputEventsGetSwitches(msg, conn, true);
703
		}
558
		else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameAcquired")) {
704
		else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameAcquired")) {
559
			signal_NameAcquired(msg);
705
			signal_NameAcquired(msg);
560
		}
706
		}
561
		else if (dbus_message_is_method_call(msg, "org.freedesktop.DBus.Introspectable", "Introspect")) {
707
		else if (dbus_message_is_method_call(msg, "org.freedesktop.DBus.Introspectable", "Introspect")) {
562
			reply_Introspect(msg, conn);
708
			reply_Introspect(msg, conn);
563
		}
709
		}
710
		else if (dbus_message_is_method_call(msg, "org.freedesktop.DBus.Properties", "GetAll")) {
711
			reply_PropertiesGetAll(msg, conn);
712
		}
564
		else {
713
		else {
565
			error_UnknownMessage(msg, conn);
714
			error_UnknownMessage(msg, conn);
566
		}
715
		}
(-)a/tdecore/tdehw/tdehardwaredevices.cpp (-9 / +80 lines)
Lines 97-107 unsigned int reverse_bits(register unsigned int x) Link Here
97
	return((x >> 16) | (x << 16));
97
	return((x >> 16) | (x << 16));
98
}
98
}
99
99
100
#define BIT_IS_SET(bits, n) (bits[n >> 3] & (1 << (n & 0x7)))
100
#define BITS_PER_LONG (sizeof(long) * 8)
101
101
#define NUM_BITS(x) ((((x) - 1) / BITS_PER_LONG) + 1)
102
#if defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_NETWORK_MANAGER_BACKEND)
102
#define OFF(x)  ((x) % BITS_PER_LONG)
103
#define BIT(x)  (1UL << OFF(x))
104
#define LONG(x) ((x) / BITS_PER_LONG)
105
#define BIT_IS_SET(array, bit)  ((array[LONG(bit)] >> OFF(bit)) & 1)
106
107
#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_NETWORK_MANAGER_BACKEND)
108
#include <tqdbusconnection.h>
109
#include <tqdbusproxy.h>
110
#include <tqdbusmessage.h>
103
#include <tqdbusvariant.h>
111
#include <tqdbusvariant.h>
104
#include <tqdbusdata.h>
112
#include <tqdbusdata.h>
113
#include <tqdbusdatalist.h>
105
// Convenience method for tdehwlib DBUS calls
114
// Convenience method for tdehwlib DBUS calls
106
// FIXME
115
// FIXME
107
// Should probably be part of dbus-1-tqt
116
// Should probably be part of dbus-1-tqt
Lines 3105-3118 void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist Link Here
3105
		// Try to obtain as much specific information about this event device as possible
3114
		// Try to obtain as much specific information about this event device as possible
3106
		TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(device);
3115
		TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(device);
3107
		int r;
3116
		int r;
3108
		char switches[SW_CNT];
3117
		unsigned long switches[NUM_BITS(EV_CNT)];
3109
3118
3110
		// Figure out which switch types are supported, if any
3119
		// Figure out which switch types are supported, if any
3111
		TDESwitchType::TDESwitchType supportedSwitches = TDESwitchType::Null;
3120
		TDESwitchType::TDESwitchType supportedSwitches = TDESwitchType::Null;
3112
		if (edevice->m_fd < 0) {
3121
		if (edevice->m_fd < 0) {
3113
			edevice->m_fd = open(edevice->deviceNode().ascii(), O_RDONLY);
3122
			edevice->m_fd = open(edevice->deviceNode().ascii(), O_RDONLY);
3114
		}
3123
		}
3115
		r = ioctl(edevice->m_fd, EVIOCGBIT(EV_SW, sizeof(switches)), switches);
3124
		r = ioctl(edevice->m_fd, EVIOCGBIT(EV_SW, EV_CNT), switches);
3125
#ifdef WITH_TDEHWLIB_DAEMONS
3126
		if( r < 1 ) {
3127
			TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
3128
			if (dbusConn.isConnected()) {
3129
				TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol",
3130
					"/org/trinitydesktop/hardwarecontrol",
3131
					"org.trinitydesktop.hardwarecontrol.InputEvents",
3132
					dbusConn);
3133
				if (switchesProxy.canSend()) {
3134
					TQValueList<TQT_DBusData> params;
3135
					params << TQT_DBusData::fromString(edevice->deviceNode().ascii());
3136
					TQT_DBusMessage reply = switchesProxy.sendWithReply("GetProvidedSwitches", params);
3137
					if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
3138
						TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List();
3139
						TQValueList<TQ_UINT32>::const_iterator it = list.begin();
3140
						for (r = 0; it != list.end(); ++it, r++) {
3141
							switches[r] = (*it);
3142
						}
3143
					}
3144
				}
3145
			}
3146
		}
3147
#endif
3116
		if (r > 0) {
3148
		if (r > 0) {
3117
			if (BIT_IS_SET(switches, SW_LID)) {
3149
			if (BIT_IS_SET(switches, SW_LID)) {
3118
				supportedSwitches = supportedSwitches | TDESwitchType::Lid;
3150
				supportedSwitches = supportedSwitches | TDESwitchType::Lid;
Lines 3141-3163 void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist Link Here
3141
			if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) {
3173
			if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) {
3142
				supportedSwitches = supportedSwitches | TDESwitchType::VideoOutInsert;
3174
				supportedSwitches = supportedSwitches | TDESwitchType::VideoOutInsert;
3143
			}
3175
			}
3144
#if 0	// Some old kernels don't provide these defines... [FIXME]
3176
#			ifdef SW_CAMERA_LENS_COVER
3145
			if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) {
3177
			if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) {
3146
				supportedSwitches = supportedSwitches | TDESwitchType::CameraLensCover;
3178
				supportedSwitches = supportedSwitches | TDESwitchType::CameraLensCover;
3147
			}
3179
			}
3180
#			endif
3181
#			ifdef SW_KEYPAD_SLIDE
3148
			if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) {
3182
			if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) {
3149
				supportedSwitches = supportedSwitches | TDESwitchType::KeypadSlide;
3183
				supportedSwitches = supportedSwitches | TDESwitchType::KeypadSlide;
3150
			}
3184
			}
3185
#			endif
3186
#			ifdef SW_FRONT_PROXIMITY
3151
			if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) {
3187
			if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) {
3152
				supportedSwitches = supportedSwitches | TDESwitchType::FrontProximity;
3188
				supportedSwitches = supportedSwitches | TDESwitchType::FrontProximity;
3153
			}
3189
			}
3190
#			endif
3191
#			ifdef SW_ROTATE_LOCK
3154
			if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) {
3192
			if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) {
3155
				supportedSwitches = supportedSwitches | TDESwitchType::RotateLock;
3193
				supportedSwitches = supportedSwitches | TDESwitchType::RotateLock;
3156
			}
3194
			}
3195
#			endif
3196
#			ifdef SW_LINEIN_INSERT
3157
			if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) {
3197
			if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) {
3158
				supportedSwitches = supportedSwitches | TDESwitchType::LineInInsert;
3198
				supportedSwitches = supportedSwitches | TDESwitchType::LineInInsert;
3159
			}
3199
			}
3160
#endif
3200
#			endif
3161
			// Keep in sync with ACPI Event/Input identification routines above
3201
			// Keep in sync with ACPI Event/Input identification routines above
3162
			if (edevice->systemPath().contains("PNP0C0D")) {
3202
			if (edevice->systemPath().contains("PNP0C0D")) {
3163
				supportedSwitches = supportedSwitches | TDESwitchType::Lid;
3203
				supportedSwitches = supportedSwitches | TDESwitchType::Lid;
Lines 3174-3179 void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist Link Here
3174
		// Figure out which switch types are active, if any
3214
		// Figure out which switch types are active, if any
3175
		TDESwitchType::TDESwitchType activeSwitches = TDESwitchType::Null;
3215
		TDESwitchType::TDESwitchType activeSwitches = TDESwitchType::Null;
3176
		r = ioctl(edevice->m_fd, EVIOCGSW(sizeof(switches)), switches);
3216
		r = ioctl(edevice->m_fd, EVIOCGSW(sizeof(switches)), switches);
3217
#ifdef WITH_TDEHWLIB_DAEMONS
3218
		if( r < 1 ) {
3219
			TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
3220
			if (dbusConn.isConnected()) {
3221
				TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol",
3222
					"/org/trinitydesktop/hardwarecontrol",
3223
					"org.trinitydesktop.hardwarecontrol.InputEvents",
3224
					dbusConn);
3225
				if (switchesProxy.canSend()) {
3226
					TQValueList<TQT_DBusData> params;
3227
					params << TQT_DBusData::fromString(edevice->deviceNode().ascii());
3228
					TQT_DBusMessage reply = switchesProxy.sendWithReply("GetActiveSwitches", params);
3229
					if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
3230
						TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List();
3231
						TQValueList<TQ_UINT32>::const_iterator it = list.begin();
3232
						for (r = 0; it != list.end(); ++it, r++) {
3233
							switches[r] = (*it);
3234
						}
3235
					}
3236
				}
3237
			}
3238
		}
3239
#endif
3177
		if (r > 0) {
3240
		if (r > 0) {
3178
			if (BIT_IS_SET(switches, SW_LID)) {
3241
			if (BIT_IS_SET(switches, SW_LID)) {
3179
				activeSwitches = activeSwitches | TDESwitchType::Lid;
3242
				activeSwitches = activeSwitches | TDESwitchType::Lid;
Lines 3202-3224 void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist Link Here
3202
			if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) {
3265
			if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) {
3203
				activeSwitches = activeSwitches | TDESwitchType::VideoOutInsert;
3266
				activeSwitches = activeSwitches | TDESwitchType::VideoOutInsert;
3204
			}
3267
			}
3205
#if 0	// Some old kernels don't provide these defines... [FIXME]
3268
#			ifdef SW_CAMERA_LENS_COVER
3206
			if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) {
3269
			if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) {
3207
				activeSwitches = activeSwitches | TDESwitchType::CameraLensCover;
3270
				activeSwitches = activeSwitches | TDESwitchType::CameraLensCover;
3208
			}
3271
			}
3272
#			endif
3273
#			ifdef SW_KEYPAD_SLIDE
3209
			if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) {
3274
			if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) {
3210
				activeSwitches = activeSwitches | TDESwitchType::KeypadSlide;
3275
				activeSwitches = activeSwitches | TDESwitchType::KeypadSlide;
3211
			}
3276
			}
3277
#			endif
3278
#			ifdef SW_FRONT_PROXIMITY
3212
			if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) {
3279
			if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) {
3213
				activeSwitches = activeSwitches | TDESwitchType::FrontProximity;
3280
				activeSwitches = activeSwitches | TDESwitchType::FrontProximity;
3214
			}
3281
			}
3282
#			endif
3283
#			ifdef SW_ROTATE_LOCK
3215
			if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) {
3284
			if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) {
3216
				activeSwitches = activeSwitches | TDESwitchType::RotateLock;
3285
				activeSwitches = activeSwitches | TDESwitchType::RotateLock;
3217
			}
3286
			}
3287
#			endif
3288
#			ifdef SW_LINEIN_INSERT
3218
			if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) {
3289
			if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) {
3219
				activeSwitches = activeSwitches | TDESwitchType::LineInInsert;
3290
				activeSwitches = activeSwitches | TDESwitchType::LineInInsert;
3220
			}
3291
			}
3221
#endif
3292
#			endif
3222
		}
3293
		}
3223
		edevice->internalSetActiveSwitches(activeSwitches);
3294
		edevice->internalSetActiveSwitches(activeSwitches);
3224
3295

Return to bug 1597