Enrico Zini: bluetooth-headset-for-presentations
Using a bluetooth headset for giving presentations
While looking for ways of flipping slides while not near the computer, I
stumbled on this idea
this
idea, bought a cheap headset for like 10euros and started playing.
Getting the headset to work with alsa
It's supposed to just work,
but bluez-utils in Debian has audio support
disabled.
I've rebuild the package with the patch found in the bug report, copied the
extra configuration files as I mentioned in a followup to the bug report, and
brought my Debian up to speed.
Once the patched bluez-utils is in place, this is how to get the headset to
work:
- put the headset into pairing mode
hcitool scan(to get the address of the headset)- put this in
~/.asoundrc(using the address you got withhcitool scan):pcm.bluetooth_hw type bluetooth device 00:11:22:33:44:55 ctl.bluetooth type bluetooth device 00:11:22:33:44:55 # No idea why this is needed, but it makes aplay complain a bit # less, and also it makes aoss work pcm.bluetooth type plug slave.pcm "bluetooth_hw"
hcitool cc: in order to pair with the headset, the command is:
mplayer -ao alsa:device=bluetooth moo.wav
This will trigger a funky chain of events that will eventually cause the
bluetooth applet to ask you for the pin (0000 for the headsets), get things
paired and activate super cow powers.
Now you have an alsa sound card called 'bluetooth' that works only with some,
but not all, alsa applications. mplayer works. aoss works, but not always.
aplay seems to work. twinkle won't work; apparently, it's because it tries to open the device multiple times.
Feeding synthesised speech to the headset
Synthesised speech is done by festival. Festival works with oss. The headset
works with alsa. aoss works, but not always.
This is the script I'd like to run:
#!/bin/sh
warn()
echo -n "Attenzione: "
if [ $1 == 1 ]
then
echo -n "manca un minuto"
else
echo -n "mancano $1 minuti"
fi
echo " alla fine."
(
for x in 5 4 3 2 1
do
warn $x
sleep 1
done
) festival --tts --language italian
By tweaking the sleep times and numbers a bit, it's a useful prototype that
sends updates on how much time is left for the presentation.
This, under aoss, does not work reliably. An alternative is to replace the
festival invocation with this:
echo string text2wave tmpfile.wav
mplayer -ao alsa:device=bluetooth tmpfile.wav
However, I found no way to tell text2wave to use Italian instead of English.
I did manage, however, to get some link between festival and the headphones.
At a further stage, I can write a program for the countdown that keeps
the audio device open and every once in a while gets a waveform out of
text2wave and feeds it to the audio device.
Keeping the audio device open seems a good idea, to avoid losing the beginning
of the message while the connection is established (happens with my cheap
headset) and to avoid the headset to go idle and switch off.
Reacting to the buttons on the headset
It's supposed to be possible, but I didn't manage to find out how to do this using the normal alsa driver, now that btsco is apparently deprecated.
Once I find out how to be notified of button presses, I'll try to see how to
send a Page Down keystroke to OpenOffice Impress or xpdf.
Voice commands
sphinx2-bin seems promising, but
since everyone around me is now asleep, playing with voice commands has to be
postponed.
Further ideas
- IRC link: send me a message on a public IRC channel, and I could head it on the headphone: nice for giving talks that people is watching remotely via streaming.
- Giving the percentage of time passed, instead (or additionally to) the time remaining.
- Linking with the presentation software and also say the number of slides remaining.
- Get the status update being spoken not just at regular intervals, but also when changing slide.
- Get the headset to read slide notes, or only the slide notes marked with a special leading keyword.
About a week ago, our internet connection appears to have dropped around
midnight. Not a biggie, one thinks. So on Friday morning between shower,
breakfast, and leaving for work, I power-cycled the cable modem and
I just made time to catch up on processing requests for access to LWN.net
under the Debian group subscription sponsored by
finally I found the time to write down the configuration we use on our
server to blacklist hosts that try to send emails to pre-defined nonexistent
mail addresses. it uses only
Well I've been in Devon for the past week, and will remain here for another week. During that time I've averaged about ten minutes of online time a day!
So far things are going well, but it will be wierd spending time with another family over Christmas.
Still I've been vaguely productive. I've released a new version of
Pelican has decided to
Some time ago I've been working on an AI to classify web pages. I've spidered
(and classified!) about half a million web pages I'm using for training.This totals to about 40.000 categories and 100.000 useful tokens. I need 8
bytes of storage - two float values - for each combination, which is a matrix
of about 27 Gigabytes. I'm using mmap to map my data files into memory for
convenient access. On a 64 bit system, I can keep them mmapped all the time.This results in the following funny top output:
Thursday evening, I joined the inhabitants of the twin town of 



Some more important things happened this week for Debian Installer i18n:
On January 15th, I'm going to be giving a talk on a panel at the
I'm just digging through OFTC's nickserv database to do some cleaning. We have
a bit over 20k nicknames in the database on 18k accounts which means about 10%
of registered nicks are linked to other master nicks.
By the power of sql, here's some statistics on the domain names of the
email addresses our users:

I'm so annoyed with myself.
So today was the day I was going to upgrade the disks in daedalus.
I'd finally managed to convince Dell to sell me two new 140Gb disks to
replace to two 70Gb disks that were fast approaching capacity. I'd organised
for access to the datacentre from 10am. I arrived early.
I didn't manage to get into the datacentre until about 11am, because they
were having problems remotely unlocking the door, and I had to wait until an
air conditioning repair guy turned up, who was fixing some air conditioning
problem.
I hadn't had a lot of time to plan how I was going to do the upgrade, but I
figured it was going to be pretty straightforward. Each disk is partitioned
into three partitions, all of which are mirrored using software RAID. The
first partition is the root filesystem, which is just an ext3 filesystem,
mirrored. The second partition is swap, also mirrored, and the third
partition is an LVM physical volume. The first two partitions are only a
couple of gigabytes.
So the basic plan was to remove the second disk (disk 1, aka
/dev/sdb), put in the new bigger disk, load the partition table
from the original disk 1, resync the three mirrors, and then boot off the
new disk 1, and rinse and repeat with disk 0.
This was all going swimmingly, when right at the end (in fact after the
third partition finished syncing according to the kernel), /dev/sda
decided it had a few unreadable sectors. This made the software mirroring
have a dummy-spit, and decide it needed to restart the syncing from scratch.
I'd seen this before with a bad disk.
So I wishfully hoped it was something to do with the new disk being bigger
than the old disk, so tried to roll back to the original disk 1. As was
pretty much expected, disk 0 exhibited the same problems at the same point.
So the problem was disk 0, not the new disk 1.
So it seemed like I just managed to pick the wrong half of the mirror to
work from.
I thought I'd try manually dd'ing the third partition from /dev/sda
to /dev/sdb, ignoring the errors, but that didn't result in a
usable half of a mirror either.
Interestingly, these bad sectors hadn't made themselves known until this
point. The RAID array had been otherwise healthy, and SMART hadn't uttered a
peep.
I think at this point, after spending about 3 hours fighting with it, I
decided to move up a layer. I could successfully sync /dev/md0 (the
root filesystem) and /dev/md1 (the swap device), and the only
reason I could think of these bad sectors not giving me grief already, was
because they were right at the end of the disk, and I hadn't quite used all
the free physical extents in LVM yet. Lucky I hadn't decided to grow things
any further.
So I decided that rather than trying to convince this existing
/dev/md2 to sync with the new /dev/sdb3, I'd just build a
new degraded RAID-1 on /dev/sdb3 and move all the physical extents
from the degraded RAID-1 on /dev/sda3 to the new degraded RAID-1 on
/dev/sdb3. I tried the logical volume with /tmp on it
first, since it was fairly sacrificial. It worked fine. So I tried the
largest logical volume, /srv, which was 30Gb. That went fine as
well, so I moved the rest. All of them went without complaint. So then I
removed the now unused /dev/md2 from the volume group, and finally
managed to boot with just the new disk 1. Then I was able to put in the new
disk 0, and just do a standard RAID-1 rebuild onto it. Hooray for LVM saving
the day yet again.
And this is where I should have stopped.
At this point it was about 3pm. I'd been aiming to leave by 4pm to pick up a
rental car that I had to get by 5pm. I'd wanted to also upgrade to Etch
while I was physically in front of the box, in case there were any nasty
kernel/udev issues that made the box unbootable. The catch was, I needed to
grow /var, which was quite full.
The intention had been that once I'd got the two new disks in and all synced
up, I'd create a fourth mirrored partition, and add this to LVM as a new
physical volume, then I could just keep merrily growing things. It felt a
little bit dirty having to make a new partition to get at the extra space,
and I'd reading about mdadm's "grow" mode, whilst I was sitting
around waiting for things to sync.
So I thought to myself, I'd just delete the third partition, and recreate it
using the remaining additional cylinders I now had at my disposal, then use
this grow feature of mdadm to tell Linux the array was now bigger,
then resize the physical volume, and go from there.
This is where things went a bit pear-shaped.
I deleted and recreated (larger) the third partition on each disk, and
rebooted.
I was then messing around with mdadm trying to update
/etc/mdadm/mdadm.conf, since the UUID of /dev/md2 had
changed, when I discovered that /dev/md2 had completely
disappeared.
It seems that recreating that partition made Linux completely fail to see
/dev/sda3 and /dev/sdb3 as RAID-1 members, and so because
of the fairly transparent nature of Linux's RAID-1, LVM had seen the
underlying physical volumes, and just decided to run with /dev/sda3
as the physical volume, and everything had continued to work. I just had no
redundancy any more.
So it was about 3:20pm at this stage, and I was starting to panic, thinking
I'd never get this sorted out before I had to leave, and I'd end up
returning to the US with a non-redundant mess on my hands. Then I remembered
that I had the backups of the partition tables of the old disks, from before
I removed them. So I thought I'd go back to that state, and just have the
additional cylinders unallocated. I hadn't yet attempted to grow the RAID-1
(partly because it had vanished), so in my haste, I didn't see this being a
problem.
The problem was, I'd booted into multi-user mode, and things had merrily
been operating on just half the mirror. I restored the partitions, and
rebooted, and lo and behold, /dev/md2 magically reappeared, already
100% consistent according to /proc/mdstat. I was somewhat surprised
by that, but I booted back into multi-user mode again, only to discover that
the /var filesystem was panicking and remounting itself into
read-only mode. This was pretty weird, given that during boot, it was
considered clean by e2fsck.
So I was really getting bothered by this stage, so I rebooted into emergency
mode (single-user mode in Debian starts way too much), and manually started
up LVM, and forcibly fscked everything. There was a bit of filesystem
damage to /var, /home and /srv.
Thinking I'd now fixed the problem, I rebooted into multi-user mode again,
but again /var, which was considered clean during the
fscking/mounting phase of booting, panicked shortly after mounting, and
remounted itself read-only.
So I rebooted again, broke the mirror, and forcibly fscked the filesystems
again (only operating on what was on /dev/sda3. Then I rebooted
without incident into multi-user mode and resynced the mirror.
At this point I ran away.
So I'm really annoyed with myself. This should have been a blog post about
how crap Linux's software RAID is at error recovery, and how LVM saved the
day yet again, but it was overshadowed by me overreaching in my haste, and
managing to cause silent data corruption.
The morals of this story:
Today is last day when I'll be more or less online, so if you wanted
something to me this year, it's probably already too late :-). I will
somehow follow emails, but do not expect much.
Tomorrow I'll spend by traveling back to Czechia (NGO - FRA - PRG), then
I will just enjoy time being home and not being pushed to deliver tons
of papers to somebody.
This is also most likely last blog post this year, so I can not skip the
merry Christmas and happy new year phrases ;-).