Skip to contentSkip to conversation

Logitech DiNovo Media LCD

Bluez-devel Tim Hentenaar 1 participant 1 message Dec 29, 2006 9 messages not in the archive Bluetooth drivers

lore
Share & tools
lore
#9 lore raw
In reply to a message not in the archive
Quoted 3 lines · On Thu, 28 Dec 2006 09:01:11 +0100 Patrik <[email protected]> wrote:

I'm going to reconfigure my diNovo for Bluetooth mode today or tomorrow. Please send me the patch and tell me what version to apply it against when you feel it's in "beta" stage or similar.

Attached is a patch against bluez-utils-3.8 as well as a simple python script to demonstrate the DBUS calls to control the MediaPad. I've CC'd this to the bluez-devel mailing list, to submit the patch for inclusion.

The only unimplemented [trivial] features are:
* Calulator result -> clipboard
* The damn indicator when you press the NAV button. (it does switch modes, however)

Notes:
* Users must have uinput and evdev enabled (for fakehid)
* The media button is mapped to KEY_PHONE
* The "Special Characters" mentioned in the python script might be useful for displaying certain messages.

To hook into gaim, evolution, etc. I'm probably going to
use the bluetooth-applet from bluez-gnome (to avoid writing a completely different applet, and for convienience).

Quoted 5 lines

I would love to try it out and put it on the page whenever you feel it's ready for a wider audience.

Also, I really hope that Marcel will have it merged upstream if you submit it to him.

It's 100% solid at this point. Feel free to put it up on your page, and to give me any feedback you might have :) I'll be putting it up on my personal page shortly as well.

Tim

hidd/dinovo.conf new file +18 -0
diff -ru bluez-utils-3.8/hidd/dinovo.conf bluez-utils-3.8/hidd/dinovo.conf
@@ -0,0 +1,18 @@
+<!-- This configuration file specifies the required security policies
+     for the Logitech Dinovo MediaPad driver. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="com.hentenaar.Dinovo.MediaPad"/>
+  </policy>
+
+  <policy at_console="true">
+    <allow send_path="/com/hentenaar"/>
+    <allow send_destination="com.hentenaar.Dinovo.MediaPad" />
+    <allow receive_sender="com.hentenaar.Dinovo.MediaPad"/>
+  </policy>
+</busconfig>
hidd/fakehid.c +372 -0

381 lines not on this page · raw message

hidd/hidd.h +2 -0
diff -ru bluez-utils-3.8/hidd/hidd.h bluez-utils-3.8/hidd/hidd.h
@@ -32,3 +32,5 @@
 int headset_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel);
 int jthree_keyboard(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel);
 int celluon_keyboard(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel);
+int logitech_mediapad(int sock);
+
hidd/main.c +16 -9
diff -ru bluez-utils-3.8/hidd/main.c bluez-utils-3.8/hidd/main.c
@@ -506,15 +506,22 @@
 		exit(1);
 	}
 
-	err = create_device(ctl, csk, isk, subclass, 1, 1, bootonly, encrypt, timeout);
-	if (err < 0) {
-		fprintf(stderr, "HID create error %d (%s)\n",
-						errno, strerror(errno));
-		close(isk);
-		sleep(1);
-		close(csk);
-		close(ctl);
-		exit(1);
+	if (!strcmp(req.name,"Logitech Bluetooth Mediapad")) {
+		if (!fork()) {
+			logitech_mediapad(isk);
+			close(ctl);
+			exit(0);
+		}
+	} else {
+		err = create_device(ctl, csk, isk, subclass, 1, 1, bootonly, encrypt, timeout);
+		if (err < 0) {
+			fprintf(stderr, "HID create error %d (%s)\n",errno, strerror(errno));
+			close(isk);
+			sleep(1);
+			close(csk);
+			close(ctl);
+			exit(1);
+		}
 	}
 }
 
hidd/Makefile.am +7 -3
diff -ru bluez-utils-3.8/hidd/Makefile.am bluez-utils-3.8/hidd/Makefile.am
@@ -1,15 +1,19 @@
+if CONFIGFILES
+dbusdir = $(sysconfdir)/dbus-1/system.d
+dbus_DATA = dinovo.conf
+endif
 
 bin_PROGRAMS = hidd
 
 hidd_SOURCES = main.c hidd.h sdp.c uinput.h fakehid.c
-hidd_LDADD = @BLUEZ_LIBS@ -lm $(top_builddir)/common/libhelper.a
+hidd_LDADD = @BLUEZ_LIBS@ @DBUS_LIBS@ -lm $(top_builddir)/common/libhelper.a
 
-AM_CFLAGS = @BLUEZ_CFLAGS@
+AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@
 
 INCLUDES = -I$(top_srcdir)/common
 
 man_MANS = hidd.1
 
-EXTRA_DIST = $(man_MANS) fakehid.txt
+EXTRA_DIST = $(man_MANS) fakehid.txt dinovo.conf
 
 MAINTAINERCLEANFILES = Makefile.in

#!/usr/bin/env python

import dbus

# Indicators
LCD_ICON_EMAIL = 1
LCD_ICON_IM = 2
LCD_ICON_MUTE = 4
LCD_ICON_ALARM = 8

# Indicator States
LCD_ICON_OFF = 0
LCD_ICON_ON = 1
LCD_ICON_BLINK = 2

# LCD Beep Codes
LCD_DONT_BEEP = 0
LCD_BEEP_DEEP = 1
LCD_BEEP_SHORT = 2
LCD_BEEP_LONG = 3

# LCD LED States
LCD_LED_OFF = 0
LCD_LED_BLINK = 1

# Special Characters (which might be useful)
# Note: In the interest of i18n, it's worth mentioning that the majority of Cyrillic characters are at
# 0x80 - 0x8f. The ones that overlap with Greek are in the 0x90 - 0x9f range, along with various
# Symbols (heart, 8th note, 16th node, alarm bell, etc.)
#
# For Cyrillic, the messages work fine on Winblows, which means that the LCD uses the ASCII character set
# modified as it would be for KOI8-R.

SMALL_TRIANGLE_RIGHT = "\x03"
SMALL_TRIANGLE_LEFT = "\x04"
LARGE_TRIANGLE_RIGHT = "\x10"

LARGE_TRIANGLE_LEFT  = "\x11"
QUOTE_UP             = "\x12"
QUOTE_DOWN           = "\x13"
SMALL_TRIANGLES_UP   = "\x14"
SMALL_TRIANGLES_DOWN = "\x15"
BULLET               = "\x16"
RETURN_SYMBOL        = "\x17"
ARROW_UP             = "\x18"
ARROW_DOWN           = "\x19"
ARROW_RIGHT          = "\x1a"
ARROW_LEFT           = "\x1b"
LEQUAL               = "\x1c"
GEQUAL               = "\x1d"
LARGE_TRIANGLE_UP    = "\x1e"
LARGE_TRIANGLE_DOWN  = "\x1f"

bus = dbus.SystemBus()
obj = bus.get_object("com.hentenaar.Dinovo.MediaPad", "/com/hentenaar/Dinovo/MediaPad") intf = dbus.Interface(obj, "com.hentenaar.Dinovo.MediaPad")

intf.SetIndicator(LCD_ICON_ALARM,LCD_ICON_BLINK)
intf.BlinkOrBeep(LCD_BEEP_SHORT,LCD_LED_OFF)
intf.WriteText(" -------------- "
"| Dinovo Linux |"
" -------------- ")

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel