Re: [Bluez-users] Using AVRCP with current BlueZ

Csillag Kristóf
2007-11-23T12:00:40Z

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

Hi Johan,

2007/11/22, Johan Hedberg <johan.hedberg@gmail.com>:
> I don't think there is any proper documentation yet. bluez-utils-3.22
> has some preliminary AVRCP support but by default it's disabled. You
> need to add a line "Enable=Control" to the General section in
> /etc/bluetooth/audio.conf to enable it. Currently no D-Bus signals or
> or methods are supported. Instead, the audio service uses the kernel
> uinput interface (you need to have the uinput module loaded) to inject
> keypress events to the kernel input subsystem. You can see what kind
> of AVRCP->keycode mappings are used by looking in the audio/control.c
> file from bluez-utils.

Thanks, now it works great!

One more question: what was the reason to use

KEY_NEXT and KEY_PREVIOUS, instead of
KEY_NEXTSONG and KEY_PREVIOUSSONG?

The latter are below-256 keycodes (like KEY_PLAYPAUSE,
which is used by BlueZ for pause) handled nicely by
all applications (like keytouch), where the former, which
are currently used, are extended codes, mostly unsupported
in user-space.

As far as I am interested, I changed the codes in my local
BlueZ installation so that I do not have to change keytouch.

Now it works nice with keytouch and hence audacious.

Thank you:

Kristóf

ps. Here is a patch, if anybody is interested.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: keycode_change.patch --]
[-- Type: text/x-diff; name=keycode_change.patch, Size: 1804 bytes --]

--- control.c~ 2007-10-26 01:09:15.000000000 +0200
+++ control.c 2007-11-23 12:34:52.000000000 +0100
@@ -447,8 +447,8 @@

ioctl(fd, UI_SET_KEYBIT, KEY_PLAYPAUSE);
ioctl(fd, UI_SET_KEYBIT, KEY_STOP);
- ioctl(fd, UI_SET_KEYBIT, KEY_NEXT);
- ioctl(fd, UI_SET_KEYBIT, KEY_PREVIOUS);
+ ioctl(fd, UI_SET_KEYBIT, KEY_NEXTSONG);
+ ioctl(fd, UI_SET_KEYBIT, KEY_PREVIOUSSONG);
ioctl(fd, UI_SET_KEYBIT, KEY_REWIND);
ioctl(fd, UI_SET_KEYBIT, KEY_FORWARD);

@@ -560,11 +560,11 @@
break;
case NEXT_OP:
debug("AVRCP: NEXT %s", status);
- send_key(session->uinput, KEY_NEXT, pressed);
+ send_key(session->uinput, KEY_NEXTSONG, pressed);
break;
case PREV_OP:
debug("AVRCP: PREV %s", status);
- send_key(session->uinput, KEY_PREVIOUS, pressed);
+ send_key(session->uinput, KEY_PREVIOUSSONG, pressed);
break;
case REWIND_OP:
debug("AVRCP: REWIND %s", status);
--- bluez-utils-3.22/audio/control.c~ 2007-10-26 01:09:15.000000000 +0200
+++ bluez-utils-3.22/audio/control.c 2007-11-23 12:34:52.000000000 +0100
@@ -447,8 +447,8 @@

ioctl(fd, UI_SET_KEYBIT, KEY_PLAYPAUSE);
ioctl(fd, UI_SET_KEYBIT, KEY_STOP);
- ioctl(fd, UI_SET_KEYBIT, KEY_NEXT);
- ioctl(fd, UI_SET_KEYBIT, KEY_PREVIOUS);
+ ioctl(fd, UI_SET_KEYBIT, KEY_NEXTSONG);
+ ioctl(fd, UI_SET_KEYBIT, KEY_PREVIOUSSONG);
ioctl(fd, UI_SET_KEYBIT, KEY_REWIND);
ioctl(fd, UI_SET_KEYBIT, KEY_FORWARD);

@@ -560,11 +560,11 @@
break;
case NEXT_OP:
debug("AVRCP: NEXT %s", status);
- send_key(session->uinput, KEY_NEXT, pressed);
+ send_key(session->uinput, KEY_NEXTSONG, pressed);
break;
case PREV_OP:
debug("AVRCP: PREV %s", status);
- send_key(session->uinput, KEY_PREVIOUS, pressed);
+ send_key(session->uinput, KEY_PREVIOUSSONG, pressed);
break;
case REWIND_OP:
debug("AVRCP: REWIND %s", status);

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]