Search Results: "enrico"

1 May 2008

Enrico Zini: Audit your debian uploads

Audit your debian uploads My bank is sending me an e-mail every time I log into the home banking system, so that I can spot malicious logins. My credit card is sending me a SMS message every time it gets charged, so that I can spot mailicious charges. Can I get a notification of every Debian upload done with my key, so that I can spot if my key has been stolen? Let's work on that. As a start, thanks to Ganneff, here is how to do a one-off audit:
# go to merkel to access projectb, which is the postgresql database
# with all dak information
$ ssh merkel
merkel$ psql projectb
# look up the database id of my fingerprint
projectb=> select id, fingerprint from fingerprint where fingerprint like '%797EBFAB';
 id                  fingerprint                
    -----+------------------------------------------
     394   66B4DFB68CB24EBBD8650BC4F4B4B0CC797EBFAB
    (1 row)
# get a list of all uploads done with my key, sorted by date
projectb=> select * from source where sig_fpr=394 order by install_date desc;

First you get to do it (done); then you document it (done); then you automate it. It's quite trivial at this point, so enjoy the new Debian upload monitor. It's got search as you type to find your full fingerprint, then you get an HTML page with the log of your uploads in the last 2 months, and the page has an RSS feed that you can use to track your own uploads. Also, generating all this static content is acceptably fast:
merkel$ time ./deb-key-audit 
real    0m7.145s
user    0m4.244s
sys 0m0.384s

If you want to see the code, you can git clone http://merkel.debian.org/~enrico/keylog.git Currently it wrongly encodes UTF-8 characters: I suppose the strings come out of the database as ASCII instead of UTF-8. A patch would be welcome to fix that. I will now contact QA to see what we can do with it; if it ends up fitting in some bigger picture then it may be that the RSS links will change, but I'll post about it in that case.

30 April 2008

Enrico Zini: Meet the Italian income agency

Meet the Italian income agency The Italian income agency decided to publish online all the income levels for each and every single citizen and company in the country. I did not manage to see the actual data, because the entire income agency website was swamped with request and timing out all the time. You should have heard the comments of my accountant, who every day needs to access other parts of the website for work. That service is supposed to have been taken offline now, after the Italian privacy watchdog issued a polite What The Fuck! Why Didn't You Tell Us Anything About This? sort of note. The minister defended himself by saying "I can't see what is the problem, it's the same in all the world: if you want proof just watch any American TV series". What a wise man. I should watch some of The Greatest American Hero again. Since I could not see the actual data, I could not verify if what people were saying was actually true, that is that income information were published together with the full home address, providing a nice shopping list for house robbers, kidnappers and the other kind of professionals that would politely wait next to your door for you to come home late in the night. But fear not, the website was protected from bots: it used a captcha. Not only that: in order to comply with standard accessibility rules, the website used a perfectly accessible captcha: Screenshot of full text captcha You can't get more accessible than that: the captcha is displayed in plain text, so any accessibility technology will be able to read it. Plus, anyone can easily copy and paste it into the text box. And if someone needs to do it often, it's even trivial to write a script that does it for you! But it's unfair to say that it was just plain text: it was cleverly encrypted:
<div class="educaptcha"><label for="educaptcha">I<!-- id9113507 -->nser<span>ire </span><span>nel c</span><span>ampo</span> di <!-- id5058508 -->v<span>erific</span><span>a suc</span><!-- id2643358 -->ces<span>sivo i</span><!-- id2500023 -->l valore <span>695</span><span>8571</span>4<!-- id3588853 -->:</label>
<input id="educaptcha" type="text" name="ucaptcha" value="" maxlength="10" size="20" /></div>

For your convenience, here is the version cracked with a malicious :%s/<[^>]\+>//g in vim. If you do not speak Italian, you can still look for this phrase in the screenshot above:
Inserire nel campo di verifica successivo il valore 69585714:

The meaning is of course:
Insert the value 69585714 in the following verification field:

It's been a fun day for Italians online.

24 April 2008

Enrico Zini: How to not start a service by default

How to not start a service by default Use case: in my laptop, I sometimes need MySQL, PostgreSQL or Apache in order to test some software that I'm developing, but I do not want them on all the time. The solution is: rm /etc/rc*.d/S*mysql* (thanks to Wouter) update-rc.d will not touch your symlinks as long as there is at least one still around for a package. Also, this leaves the stop symlinks around, so that when I start one of these services for development, it will still be properly stopped on shutdown.

19 April 2008

Enrico Zini: Laptop stolen

Laptop stolen Last thursday I flew from Italy to Manchester as usual, and while walking home from Levenshulme railway station my laptop has been snatched off me by a gang of thieves. I've managed to give the police all the details of the laptop including the serial number. I could also precisely describe to them the dynamics of the incident pointing at places over satellite maps in google maps. And give them the time of the theft with 10 seconds accuracy. And show them pictures of all stolen goods with a few simple internet searches. They were impressed. All sensitive data in the laptop are protected with one or two layers of strong encryption, and I have fresh backups, so the only work that I've lost was the work I did on the train and airplane on my way to the UK. If anyone around Manchester or Stockport happens to see, in a Cash Generator or second hand shop, a suspicious looking white ASUS laptop with a Taiwanese keyboard (US-style keyboard with extra Traditional Chinese and Bopomofo glyphs on it), please quietly walk out of the shop, alert the police and send me an e-mail. The day after the theft I managed to talk with a pub owner in the area, and there I learnt that pubs are networked and alert each other when suspicious people are roaming around. Lesson learned: if I see suspicious people around the street whem I'm walking home with my laptop, it's a good idea to go inside a pub and ask how's the situation. That night, for example, they've been alerting their customers of the danger. I wish the railway station had done the same.

3 April 2008

Stefano Zacchiroli: moving well moved

/me has moved to Paris Well, this is not really an "I'm moving" post, but rather a "I've moved" post: starting from past Tuesday I'm now living in Paris. I will be working as a post-doc in the mancoosi project, which is a wonderful occasion to merge my research work with my free software enthusiasm. I've also submitted a talk proposal about mancoosi for DebConf8, ... it will be a good occasion to chat about it if you are interested. My office is in the PPS lab, which was already quite packed of Debianers, /me is just one more, happy to join the crowd! The first day of shopping in Paris forces me to post a picture on the very same lines of Enrico's "how to freak out a French person". Mine below can be titled how to freak out an inhabitant of Modena: fake balsamic vinegar Here you are: balsamic vinegar flavoured with figs or honey ..., tasty eh? (dedicated to gareuselesinge) PS unfortunately at home I'm still without network connectivity (unless you count poorly working, up 1 random hour per day, stolen wi-fi as connectivity), so I won't be able to work on Debian et al. a lot from home in the next few weeks.

29 March 2008

Enrico Zini: OpenStreetMap party at Kaohsiung, Taiwan

OpenStreetMap party at Kaohsiung, Taiwan Apparently, yesterday we had the first OpenStreetMap event in Taiwan! We met in a caf /restaurant equipped with power plug, wireless network and overhead projector and we had a bit of an introduction, chat and lunch. Then we split in groups and exploited the fact that the newly built underground (KMRT) system is still free of charge, to spread around and map around the stations. Finally, we reconvened at someone's house to see how to put the data together, draw roads, tag and upload. Highlights of the day: Technical bits: Issues to address:

24 March 2008

Enrico Zini: Glitches in the Matrix

Glitches in the Matrix Taiwanese license plate over German license plate with K nation code] Korean car with Taiwanese license plate (edited to anonymise it) over EU license plate with (Portuguese??) numbers on the right, and Korea as country code. 'Italian' pasta sold by British supermarked in Taiwan Italian pasta sold by a British supermarket, in Taiwan. Also, "Messicani" is not a kind of Italian pasta. Google for it, and you'll only find it mentioned in British websites.

Enrico Zini: How to freak out a Frenchperson

How to freak out a Frenchperson
Bottles with 'Champagne Soda' label
'Champagne Soda' label close-up 'Champagne Soda' label close-up
'Champagne Soda' label close-up 'Champagne Soda' label close-up
The way to freak out an Italian, instead, is to show them a bottle of "Lambrini" in the UK.

23 March 2008

Enrico Zini: Italian National Anthem

Italian National Anthem Christian mentions that he likes the Italian National Anthem, although not the words. No Italian in their right mind likes the words; luckily we are generally not forced to learn them, so we can allow ourselves to not give a damn about it. Which is our general strategy to deal with all the insanity we get every day. What's the point of a nationalist anthem anyway, when the people who care most about the country are wishing for the Germans to invade us? Anyway, here's my attempt at national anthem lyrics that suck less, for the benefit of those, like Christian, who like the music but not the words.
Fratelli d'Italia
L'Italia s' desta,
Chi cazzo sto Scipio
Che ci han messo in testa.
Non c' la Vittoria
che porge la chioma,
Siam schiavi di Roma
E del Vatican.
Scongiuri alla sorte
Si rischia la morte
Si spera di no.
Noi siamo da secoli
Calpesti, derisi,
Perch siam mafiosi
ladroni e collusi.
Si rischia di nuovo
di aver Berluscone
Dell'emigrazione
Gi l'ora suon .
Scongiuri alla sorte
Si rischia la morte
Si spera di no.
Uniamoci, amiamoci,
l'unione, e l'amore
Ridanno alla gente
Il suo buonumore;
Giuriamo far sesso
sul suolo nat o:
Chiaviamo, perd o,
Chi dice di no?
Scongiuri alla sorte
Si rischia la morte
Si spera di no.
Dall'Alpi a Sicilia
Noi ti condoniamo,
Ogn'uom di Bettino
Ha il core, ha la mano,
I bimbi d'Italia
Fan calcio balilla,
Bastardo chi frulla
Gancin non si pu .
Scongiuri alla sorte
Si rischia la morte
Si spera di no.
I nostri politici
Son tutti venduti:
Si sente dall'Austria
L'odor dei rifiuti.
Lavora in Italia,
Il nero, il Polacco,
In nero, perbacco,
Io lo pagher .

Scongiuri alla sorte
Si rischia la morte
Si spera di no.

18 March 2008

Enrico Zini: make distcheck and LaTeX

make distcheck and LaTeX When building LaTeX documentation on a VPATH build, if your .tex file includes other files in the same directory, LaTeX will complain that it cannot find them. The reason is because in a VPATH build, latex is invoked like this:
latex ../../doc/manual.tex

What we need here is an equivalent to cc's -Idir for latex. latex --help doesn't mention of such an option, nor of useful environment variables. Googling a bit seems to suggest --include-directory=dir, but that gives me: unrecognized option '--include-directory=../../doc' The manpage doesn't list commandline options. It however says:
The complete documentation for this version of TeX can be found in the info file or manual Web2C: A TeX implementation.
Without saying where that manual is, if it's installed and where, or what package installs it, or if instead should I look it up on the web. info latex gives the manpage itself, of course. Googling the title of that manual finds it, and it's a long one. Reading through, it points at the kpathsea manual, which then mentions you can set TEXINPUTS_latex, which however doesn't add but overrides, so your document will find the includes maybe, but not the LaTeX styles and other stuff. But then later on it mentions that in the env variable you can use "default expansion", and it's another page of manual to read which tells you to put an extra colon in the end of the env var. After half an hour of googling and trying things and cursing loud, here is the solution, which I hope will save others from this ugly search.
%.aux: %.tex
    TEXINPUTS="$(srcdir):" latex $<
# Oh, yes, and bibtex requires BIBINPUTS instead
%.bbl: %.aux
    BIBINPUTS="$(srcdir):" bibtex  basename $< .aux 

17 March 2008

Miriam Ruiz: OpenRating Game Classification System

Some time ago I started developing a system to classify free games for Debian, based in Enrico’s DebTags. Up to now I’ve been able to develop a basic set of tags to classify the games, so it’s time to start tagging the games. I’d really like to get as much feedback as possible, especially from teachers, educators, parents and in general people that work with and study about children. The idea is not to develop a fully exhaustive system with a thousand tags. I believe that parents and tutors must check themselves the games before letting their kids play with them, and supervise them while they do if they’re little. This does not try to be a replacement for parents, but a helper to let them have a rough idea about where to look at the games in the repositories according to their own criteria. Being exhaustive is thus not as a priority as keeping the system simple and easy enough. I’ve designed the tags along 3 main lines:
1) Contents that might not be wanted by some parents, teachers or tutors.
2) Games too complex for some children’s cognitive and/or coordination skills
3) Educative contents and skills that the game might help to develop. Right now some of the tags are already being used by GoPlay!, a system to find games in Debian, but it a very alpha state. The purpose is to make it configurable so that parents can decide which tags are important for them. I hope to achieve that in the next version of the program. I hope that the overall scheme can be understood, but I plan to write a rationale about it as soon as I can, as well as develop some examples so that they can be easily understood. I know that the tags might be a bit subjective and probably a bit culturally biased. The former is not avoidable, there will always be some kind of subjectivity in these kind of classification, so I won’t fight the impossible to achieve absolute objectiveness. I’m trying to compensate that by allowing parents and tutors decide the subjectivity they want to have by selecting and priorizing the tags. About being multicultural, I cannot do that on my own, as I’m not that multicultural myself, so I won’t try to invent what other cultures might be worried about or not based on some fuzzy stereotypes I might have about them. If someone from a different culture steps forward and wants to help, they will be welcome. I prefer to rely on other people from different cultures help me to broaden the classification. Feedback is of course welcome and encouraged.

9 March 2008

Enrico Zini: ldap-userdb-fields

Fields used by an LDAP Unix user database Some notes about LDAP for Unix user management: Meaning of fields for objectClass posixAccount: Meaning of fields for objectClass posixGroup: For objectClass inetOrgPerson: what you put there can be used as if it were a vCard by mail programs and contact lists. Now, the name of people could potentially be split in cn,givenName,sn,gecos and displayName (possibly more): how would normal user tools deal with the redundancy? To show a gecos field, pam_ldap will search for a gecos field first, then automatically fallback on building a gecos field out of the other suitable info it finds. To show a name, sane programs try displayName first and if it's not present they guess using the rest. Then there is the issue of how to chose the dn to identify users, groups and so on. Users usually go in uid=$USERNAME,ou=People,$SUFFIX, while groups would usually go in cn=$GROUPNAME,ou=Groups,$SUFFIX. Should you need to create the People and Groups organizational units, this could be the proper bit of LDIF:
dn: ou=$NAME,$SUFFIX
ou: $NAME
objectClass: organizationalUnit
To add fields that are not already part of a schema, one needs to create their own schema. To do that, one needs to first obtain (free of charge) a Private Enterprise Number that is used in various places in the schema definition. Making up your own one means risking conflicts if you eventually grow larger. But it is rarely needed, because for most things there are already schemas available. Many thanks to Wouter and noshadow for allowing me to crudely extract all this content from their brains.

8 March 2008

Enrico Zini: gpsdrive-osm

Uploading gpsdrive tracks to openstreetmap I've got some gpsdrive tracks and my area is blank on openstreetmap. People pointed me at gpsbabel, and it took me a while to figure how it works. For the record, don't do any of this:
gpsbabel -i gpsdrive -o gpx -f track0000.sav -F track0000.gpx
gpsbabel -i gpsdrive -o gpx track0000.sav track0000.gpx
What you would have to do is this:
gpsbabel -i gpsdrive -f track0000.sav -o gpx -F track0000.gpx
However, it would choke on gpsdrive's "missing" points with all values set to 1001. You can grep them out, then gpsbabel would work, but openstreetmap would reject the data because the points have no timestamp: gpsbabel won't carry that on from the gpsdrive tracks to the GPX tracks. The way to go is here, which contains a link to a tiny little perl script that will do the proper conversion for you:
./gpsdrive2gpx.pl track0000.sav > track0000.gpx
Those you can upload them to openstreetmap, at last.

5 March 2008

Simon Richter: Input formatting with iostreams

Enrico, you were probably looking for std::cout << (std::stringstream() << "foo" << std::setw(8) << "bar").rdbuf() << std::endl; which is a WTF in itself.

Enrico Zini: iostream-formatting

Formatting numbers with iostream What is the output of this C++ program?
#include <stdio.h>
#include <iostream>
#include <iomanip>
using namespace std;
main()
 
    printf("%05d\n", -3);
    cout << setw(5) << setfill('0') << -3 << endl;
 
It turns out that it is:
-0003
000-3
To get the numbers where you'd like them to be, you do it this way:
printf("%05d\n", -3);
cout << setw(5) << setfill('0') << internal -3 << endl;
Compare with C to see why C++ iostream is not really that much used. Also, setfill and internal are persistently changing the state of the stream, contributing fancy and interesting side effects:
cout << setw(5) << setfill('0') << internal << -3 << endl;
cout << setw(10) << "ciao" << endl;
this prints:
-0003
000000ciao
and I didn't see any sort of RAII save and restore of the stream state, nor a particularly obvious way to reset the stream to factory settings. Suppose that the function foo throws an exception here:
try  
    cout << setfill('=');
    cout << setw(10) << foo() << endl;
    cout << setfill(' ');
  catch (MyException& e)  
    // Catch this hypotetical exception
    cerr << setw(3) << e.errCode() << ": " << e.msg() << endl;
 
Then the state of the stream never gets reset, and the error code ends up being padded with equals instead of the default space. What would the alternative be, reset the stream state after each function call in the code? Or am I missing something? Update: here are some suggested, but still not optimal, ways of dealing with it: From Simon Richter:
std::cout << (std::stringstream() << "foo" << std::setw(8) << "bar").rdbuf() << std::endl;
From Peter De Wachter:
fstream tmp;
tmp.copyfmt(cout);
cout << setw(5) << setfill('0') << internal << -3 << endl;
cout.copyfmt(tmp);
cout << setw(10) << "ciao" << endl;
This is a possible RAII class to save the stream state (based on Peter De Watcher's approach), but I suspect that creating a fstream for every block that uses iomanip operators is rather heavyweight:
    struct SaveIOState
     
            fstream tmp;
            ostream& s;
            SaveIOState(ostream& s) : s(s)
             
                    tmp.copyfmt(s);
             
            ~SaveIOState()
             
                    s.copyfmt(tmp);
             
     ;

8 February 2008

Enrico Zini: m2crypto-howto

How to work with python-m2crypto This is a little howto on how to understand the m2crypto Python module, beyond the examples provided:
  1. Build the documentation as explained here
  2. Look at the documentation, which does not contain a single comment
  3. Click the links that show the source (for example, of M2Crypto.SMIME.SMIME.verify)
  4. Look what openssl function gets called by the function you are interested in (for example, pkcs7_verifysomething))
  5. Google the name of that openssl function, trying a few variations, until you find the openssl manpage that tells you what it does, in detail (for example, pcks_verify)
  6. Understand what it does, and backport the understanding to the thin convenience layer that m2crypto adds on top of it
  7. Realise that now you also understand the corresponding openssl smime -verify commandline invocation, and that next time instead of reading the openssl manpage you should look at the openssl api docs instead.

31 December 2007

Enrico Zini: happy-new-year

Happy new year A year ago we got in touch with various Taiwanese aboriginal tribes to try to start localisatione efforts. Thanks to the research the Taroko people did during 2007 and the prototype work of tonight, the Taroko people in Taiwan can see the computer calendar of the new year in their own language: trv_TW Gnome calendar

29 December 2007

Enrico Zini: eeepc

Meet the EeePC Being in Taiwan, we swiftly got hold of an Eeepc. Instead of installing Debian into it, we decided to keep the original system and see how it works. It's a Debian derivative, and the feeling inside a terminal window is quite familiar. The boot is very fast. Two seconds after the video bios quickly shows on the screen, the X cursor appears. It's definitely worth having a look at how this devil boots. The "Asus Launcher" is worth a look. IMHO it's nicer and more useful than the usual launcher menu that we get in Gnome or KDE 3, although it probably only makes sense on a small display. It replaces the desktop background, has tabs, no clutter and allows to launch applications. Turns out it's customisable as well. What's on the system KDE 3.4.2, with some applications renamed so that their names are more human. For example, konsole became console. vim! \o/ But not emacs :) mc! Someone out there wanted to make my life easier. fbreader. I had never heard of it, but it's a very good discovery that I've now started to use it on my laptop as well. Little howtos To get to a terminal, hit Ctrl+T in the file manager, or Ctrl+Alt+T elsewhere. The root password is the same as the user password. To change the system language, I managed with a simple dpkg-reconfigure locales. Ways they simplified the unix system It's single user: I didn't find a way to create multiple users besides the terminal, and the login program does not ask for a username, only for the password. The "win" key has a house painted on it, and it's used as "hide/show all applications" key. When all applications are minimised, the Asus launcher is visible instead of the X background: this behaviour basically turns the key into a sort of "run application" key. The key still works as a kind of shift, although it probably was not intended to. The repository management is interesting. /etc/apt/sources.list contains:
deb http://update.eeepc.asus.com/p701 p701 main
deb http://update.eeepc.asus.com/p701/tw p701 main
which means they have a repository per eepc model and a subrepository per localised version. The "Internet" group of applications has a Wikipedia toplevel application: it's nice to see the ecosystem of free software / free culture coming together to provide a nice user experience. An extra link to the SD card mount point (besides the one in /mount) appears in the home directory automatically when the SD card is inserted. This means that when you do "save as" from all sorts of applications, the SD card is there, easy to reach. This helps if one decides not to use the internal flash for data, and just save everything in the SD card: I like doing this, as it allows me to quickly move the SD card with all the data between the EeePC and other computers. Changes I made so far Activate en_GB.UTF-8 via dpkg-reconfigure locales. Add en_GB.UTF-8 to /etc/scim/global, to get SCIM input methods to work. Little flaws Virtual screens are enabled, so W+arrow switches virtual screen. The feeling you get if you hit W+arrow is that all your applications disappeared. This could be improved by having the vm keep the asus launcher at the bottom of the current virtual screen, instead of just at the bottom of the first screen. Or, to disable virtual screens by default. It is possible to drag the lower panel around, maybe accidentally: that's another of our fancy default "features" that should be disabled by default. It is also possible to remove applets from the applet bar by mistake: for example I wanted to disconenct the wireless, and I instead ended up quitting the wireless applet. Luckily, the next time I started the computer it magically came back. ~/.xsession-errors is continuously getting the useless stdout/stderr debugging flood of GUI apps. Noone bothers usually, except that in this case the file is on flash, where unneeded writes are also very much unwanted. I'm considering symlinking it to /dev/null, but ideally we should get GUI apps to only write out what is really important. Battery charging doesn't show how long it is going to take until the battery is fully charged. No capslock or numlock leds. This probably calls for disabling or remapping of capslock. Numlock is very hard to hit by accident, but capslock is. Random thoughts If you buy an eeepc, I really suggest you think of it a mass consumption appliance and stay on the original OS for a while. Most of what's in here is what we use everyday, just on a different context. Try to use it as an appliance and see if it is perfect, and if it isn't, try to find out what is missing. It is a fantastic way to find out important bits that are missing in Debian as well. Also, if you're used to tailoring everything to yourself before starting to use a Linux system, this is a great way to try the usage experience that we can offer by default. The Firefox welcome page the first time you connect, for example, is surprisingly nice. Everything we know as doable comes a bit as as a surprise because this time someone has done it for us. I wish that that someone can be invited to talk at the next Debconf: the possibility of having a look at the work that has been done in bending Debian to this nice little device is to me one of the most valuable things so far about the eeepc. Help/About KDE/Credits It's reachable by most applications, and says:
The development team would like to thank the following people and organizations for their contributions:
  • the Debian Project,
  • the GNU Project,
  • the KDE Project,
  • the Mozilla Project,
  • the OpenOffice.org Project,
  • the SAMBA Project,
  • the X.Org Foundation,
Linus Torvalds and the other Linux kernel developers, and Free software developers around the world.
I'm using an appliance that is thanking me, and others like me: priceless!

Christian Perrier: eeepc and the French keyboard

Enrico's post about the EeePC made me look closer to this thing. Wow. I actually didn't know that this PC is not only designed to be cheap and small and running Linux....but *also* has a custom Debian distribution pre-installed. Given the various explanations given by Enrico, that seems to be a killer CDD, indeed. It's been a while since I want to install a machine for my father in law, who's 85 without any computing skills. I was about to install a light Debian system on a small laptop but I was really fearing that some quirks we (geeks) never notice would be blockers. Apparently, Asus managed to polish everything to a level that's suitable for the average user (making compromises, of course, such as the user management system but, hey, when one knows about the "user management" in Windows XP Home, that's still a huge improvment). So, the last blocker for /me to buy such a beast is the damn keyboard. I can't imagine giving a machine without our beloved French AZERTY keyboard (even to a non computer-skilled person: we have tons of appliances around here, including the (in)famous Minital that do use this keymap). So, do Asus sell these for exotic countries? :-). Of course, any hack like putting stickers on a crappy QWERTY keyboard is out of question.

28 December 2007

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:
  1. put the headset into pairing mode
  2. hcitool scan (to get the address of the headset)
  3. put this in ~/.asoundrc (using the address you got with hcitool 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"
     
    
Now, forget 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

Next.

Previous.