
This depends on Bounce (the N900 .deb) and SDL 1.2 being installed. Google "bounce_1.0.0_armel.deb" for the former, and use n9repomirror for the latter.
This depends on Bounce (the N900 .deb) and SDL 1.2 being installed. Google "bounce_1.0.0_armel.deb" for the former, and use n9repomirror for the latter.
To unpack the chroot tarball:
sudo debootstrap --arch armhf --foreign sid sid
sudo tar czvf sid.tgz -C sid .
du -sh sid.tgz
# 98M sid.tgz
scp sid.tgz nemo@192.168.2.15:
To enter the chroot:
ssh nemo@192.168.2.15
devel-su
# password
mkdir sid
cd sid
tar xvf ../sid.tgz
chroot /home/nemo/sid/ /debootstrap/debootstrap --second-stage
chroot /home/nemo/sid/ apt-get clean
echo "deb http://http.debian.net/debian sid main" \
>/home/nemo/sid/etc/apt/source.list
ssh nemo@192.168.2.15
devel-su
# password
mount --bind /proc /home/nemo/sid/proc
mount --bind /sys /home/nemo/sid/sys
mount --bind /dev /home/nemo/sid/dev
mount --bind /dev/pts /home/nemo/sid/dev/pts
cp /etc/resolv.conf /home/nemo/sid/etc/
chroot /home/nemo/sid/
apt-get update
import dbusMediaButtonsHandler is already a QObject subclass, so you can easily expose an instance of this class to your QDeclarativeView rootContext() and connect to the signals in QML (such a "headset button handler" might actually be a good candidate for inclusion into nemo-qml-plugins in Sailfish OS and Nemo Mobile?). As it's really just using the Python D-Bus bindings to get property changes from Hal devices, the code above should be easy (read: trivial) to port from Python to Qt/C++. Be aware that you need to connect to both .../computer_logicaldev_input_0 and .../computer_logicaldev_input, which can both exist if you have a cable headset and a Bluetooth headset connected at the same time.
class MediaButtonsHandler(QtCore.QObject):
def __init__(self):
QtCore.QObject.__init__(self)
headset_path = '/org/freedesktop/Hal/devices/computer_logicaldev_input_0'
headset_path2 = '/org/freedesktop/Hal/devices/computer_logicaldev_input'
system_bus = dbus.SystemBus()
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path)
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path2)
def handle_button(self, signal, button):
if signal == 'ButtonPressed':
if button in ('play-cd', 'phone'):
self.playPressed.emit()
elif button == 'pause-cd':
self.pausePressed.emit()
elif button == 'previous-song':
self.previousPressed.emit()
elif button == 'next-song':
self.nextPressed.emit()
playPressed = QtCore.Signal()
pausePressed = QtCore.Signal()
previousPressed = QtCore.Signal()
nextPressed = QtCore.Signal()