Le 14126ième jour après Epoch,
Dale Maggee écrivait:

> Al Johnson wrote:
>> Doesn't do it in 2008.8 though, and the bug report was closed as 'wontfix'
>>
>> http://docs.openmoko.org/trac/ticket/1442
>>   
>
> Oh, joy!
>
>
> /me removes "check out 2008.8-update" from his to-do list

You can use the attached script to do that... Run it as a nohup
background process, or put it on session start scripts.

Pay attention that when you receive a call, the script is not awaken,
so result is unpredictable... (I've not tested this case, because I've
no friends calling me ^^)

#!/usr/bin/python
# jack.py - An application to read jack
#
# Version 0.1
#
# Authors: Francois TOURDE <[EMAIL PROTECTED]>
#
# Copyright (c) 2008 Thomas Wood
#
# jack.py is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# jack.py is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# TODO
#
# Change List
#
# 2008-09-03: First release

import os
import sys

# Hexdump of /dev/input/event0
# When jack inserted
#     9131 48be a594 0001 0005 0002 0001 0000
#     9131 48be a5f9 0001 0000 0000 0000 0000
# When jack removed
#     9131 48be a594 0001 0005 0002 0000 0000
#     9131 48be a5f9 0001 0000 0000 0000 0000


# Open the jack sensor
f = open("/dev/input/event0", "r")

while 1:
  block = f.read(16)
  if block[8] == "\x05":
    if block[10] == "\x02":
      if block[12] == "\x01":
        os.system("alsactl -f /usr/share/openmoko/scenarios/headset.state restore")
      if block[12] == "\x00":
        os.system("alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore")

# Close the jack
f.close()
-- 
 [11:39] <Arold>: 8h
 [11:39] <obionedtc>: 18h putain
 [11:39] <Arold>: euh oui 18h
 -+- : in Guide du Petit Joueur: t'as quelle heure, toi ? -+-
_______________________________________________
support mailing list
[email protected]
https://lists.openmoko.org/mailman/listinfo/support

Reply via email to