Qjackctl - DBUS

Since version 0.3.4.11 qjackctl offers DBUS support to start and stop the JACK audio server:

From the change-log:

A couple of primitive D-Bus interface slots have been introduced,
giving the option to start/stop the jackd server from the system
bus eg. via dbus-send --system / org.rncbc.qjackctl.start (stop),
(a nice addition supplied by Robin Gareus, thanks).

The DBUS addition qjackctl is mostly useful for laptops to get JACK back running after a suspend or hibernate cycle.

My motivation was simple: Since skype started working with jackplug in an .asoundrc I missed a couple of calls simply because I forgot to launch jackd after a suspend/resume cycle. I figured that I spend less time hacking an DBUS addition than keep re-starting jackd by hand ;)

Any suggestions for when the dbus-send command doesn't work? I get the following error (with the DBUS option enabled in Setup): Error org.freedesktop.DBus.Error.UnknownMethod: Method “start” with signature ”” on interface “org.rncbc.qjackctl” doesn't exist

RE: The error message is misleading. If a dbus-method is called for an object that is not documented in the dbus-schema in /etc/dbus-1/system.d/*, this error message will be returned. It should work nevertheless. (Apparently one can configure the emission of these warnings in /etc/dbus-1/ but don't call me on details about it.) The proper solution would be to file a bug report with qjackctl (or packagers thereof) to include the dbus-schema.

Setup

The command-line to launch JACK via qjackctl is

dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start

On resume you actually want to execute:

(sleep 4 ; dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start)&

which allows audio-devices to settle (eg USB-soundcards to power up, or ALSA settings to be restored) before restarting JACK.

This command needs to be executed when resuming from standby mode. Depending on your GNU/Linux distribution and suspend-software this can be achieved by

  • writing a hook script in /etc/pm/sleep.d/
  • patching /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
  • adding a script in /etc/acpi/resume.d/

As a side-note, you may want to re-launch /etc/init.d/rtirq in a similar manner. Since linux-2.6.31 some IRQ-threads (may) come up with a new PID after a suspend/resume cycle.

Any suggestions for when the dbus-send command doesn't work? I get the following error (with the DBUS option enabled in Setup): Error org.freedesktop.DBus.Error.UnknownMethod: Method “start” with signature ”” on interface “org.rncbc.qjackctl” doesn't exist

Resume Script

On Debian/squeeze I use the first option. Don't forget to mark the file executable (chmod +x /etc/pm/sleep.d/90qjackctl.sh ) after creating it.

This works also on Ubuntu 12.04

/etc/pm/sleep.d/90qjackctl.sh

#!/bin/bash
case $1 in
  hibernate|suspend)
    dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.stop
    ;;
  thaw|resume)
    (sleep 4 ; dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start)&
    # if you use rtirq to set IRQ priorites you should use:
    #(sleep 4 ; /etc/init.d/rtirq start; dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start)&
    ;;
  *)
    ;;
esac

.asoundrc

For lack of a better place to put it, here's the ~/.asoundrc (or /etc/asound.conf) that I use to run all audio through JACK. Works great with skype and even gives sound to Flash in every browser:

pcm.!default {
      type plug
      slave { pcm "jack" }
}

pcm.jack {
      type jack
      playback_ports {
              0 system:playback_1
              1 system:playback_2
      }
      capture_ports {
              0 system:capture_1
              1 system:capture_2
      }
}

ctl.mixer0 {
  type hw
  card 1
}
 
wiki/qjackctl_dbus.txt · Last modified: 09.11.2012 12:06 by 129.241.134.77