Recherche avancée

Médias (91)

Autres articles (14)

  • Utilisation et configuration du script

    19 janvier 2011, par

    Informations spécifiques à la distribution Debian
    Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
    Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
    Récupération du script
    Le script d’installation peut être récupéré de deux manières différentes.
    Via svn en utilisant la commande pour récupérer le code source à jour :
    svn co (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (2685)

  • Monster Battery Power Revisited

    28 mai 2010, par Multimedia Mike — Python, Science Projects

    So I have this new fat netbook battery and I performed an experiment to determine how long it really lasts. In my last post on the matter, it was suggested that I should rely on the information that gnome-power-manager is giving me. However, I have rarely seen GPM report more than about 2 hours of charge ; even on a full battery, it only reports 3h25m when I profiled it as lasting over 5 hours in my typical use. So I started digging to understand how GPM gets its numbers and determine if, perhaps, it’s not getting accurate data from the system.

    I started poking around /proc for the data I wanted. You can learn a lot in /proc as long as you know the right question to ask. I had to remember what the power subsystem is called — ACPI — and this led me to /proc/acpi/battery/BAT0/state which has data such as :

    present :                 yes
    capacity state :          ok
    charging state :          charged
    present rate :            unknown
    remaining capacity :      100 mAh
    present voltage :         8326 mV
    

    "Remaining capacity" rated in mAh is a little odd ; I would later determine that this should actually be expressed as a percentage (i.e., 100% charge at the time of this reading). Examining the GPM source code, it seems to determine as a function of the current CPU load (queried via /proc/stat) and the battery state queried via a facility called devicekit. I couldn’t immediately find any source code to the latter but I was able to install a utility called ’devkit-power’. Mostly, it appears to rehash data already found in the above /proc file.

    Curiously, the file /proc/acpi/battery/BAT0/info, which displays essential information about the battery, reports the design capacity of my battery as only 4400 mAh which is true for the original battery ; the new monster battery is supposed to be 10400 mAh. I can imagine that all of these data points could be conspiring to under-report my remaining battery life.

    Science project : Repeat the previous power-related science project but also parse and track the remaining capacity and present voltage fields from the battery state proc file.

    Let’s skip straight to the results (which are consistent with my last set of results in terms of longevity) :



    So there is definitely something strange going on with the reporting— the 4400 mAh battery reports discharge at a linear rate while the 10400 mAh battery reports precipitous dropoff after 60%.

    Another curious item is that my script broke at first when there was 20% power remaining which, as you can imagine, is a really annoying time to discover such a bug. At that point, the "time to empty" reported by devkit-power jumped from 0 seconds to 20 hours (the first state change observed for that field).

    Here’s my script, this time elevated from Bash script to Python. It requires xdotool and devkit-power to be installed (both should be available in the package manager for a distro).

    PYTHON :
    1. # !/usr/bin/python
    2.  
    3. import commands
    4. import random
    5. import sys
    6. import time
    7.  
    8. XDOTOOL = "/usr/bin/xdotool"
    9. BATTERY_STATE = "/proc/acpi/battery/BAT0/state"
    10. DEVKIT_POWER = "/usr/bin/devkit-power -i /org/freedesktop/DeviceKit/Power/devices/battery_BAT0"
    11.  
    12. print "count, unixtime, proc_remaining_capacity, proc_present_voltage, devkit_percentage, devkit_voltage"
    13.  
    14. count = 0
    15. while 1 :
    16.   commands.getstatusoutput("%s mousemove %d %d" % (XDOTOOL, random.randrange(0,800), random.randrange(0, 480)))
    17.   battery_state = open(BATTERY_STATE).read().splitlines()
    18.   for line in battery_state :
    19.     if line.startswith("remaining capacity :") :
    20.       proc_remaining_capacity = int(line.lstrip("remaining capacity : ").rstrip("mAh"))
    21.     elif line.startswith("present voltage :") :
    22.       proc_present_voltage = int(line.lstrip("present voltage : ").rstrip("mV"))
    23.   devkit_state = commands.getoutput(DEVKIT_POWER).splitlines()
    24.   for line in devkit_state :
    25.     line = line.strip()
    26.     if line.startswith("percentage :") :
    27.       devkit_percentage = int(line.lstrip("percentage :").rstrip(\%))
    28.     elif line.startswith("voltage :") :
    29.       devkit_voltage = float(line.lstrip("voltage :").rstrip(’V’)) * 1000
    30.   print "%d, %d, %d, %d, %d, %d" % (count, time.time(), proc_remaining_capacity, proc_present_voltage, devkit_percentage, devkit_voltage)
    31.   sys.stdout.flush()
    32.   time.sleep(60)
    33.   count += 1
  • Of ctors and dtors

    18 février 2011, par Multimedia Mike — Programming, Sega Dreamcast

    I haven’t given up on the Sega Dreamcast programming. I was able to compile a bunch of homebrew code for the DC many years ago and I can’t make it work anymore. Again, I was working with a purpose-built, open source RTOS named KallistiOS (or KOS). I can make the programs compile but not run. I had ELF files left over from years ago which still executed. But when I tried to build new ELF files, no luck— the programs crashed before even reaching my main() function.

    I found the problem : ELF files are comprised of a number of sections and 2 of these sections are named ’.ctors’ and ’.dtors’ which stand for constructors and destructors. The KOS RTOS performs a manual traversal of .ctors section during program initialization and this is where things go bad. The traversal code doesn’t seem to account for a .ctors section that only contains a single entry. I commented out the function that does the traversal and programs started to work, at least until it was time to exit the program and return control to the program loader. That’s when the counterpart .dtors section traversal code ran and demonstrated the same problem. I’ll exhibit the problematic code at the end of this post.

    So I’m finally tinkering with Sega Dreamcast programming once again and with a slightly better grasp of software engineering than the first time I did this.

    Portable and Compatible C ?
    If nothing else, this low-level embedded stuff exposes you to some serious toolchain arcana, the likes of which you will likely never see working strictly in the desktop arena.

    Still, this exercise makes me wonder why C code from a decade ago doesn’t compile reliably now. Part of it is because gcc has gotten stricter about the syntax it will accept. In the case of this specific crashing problem, I suspect it comes down to a difference in the way the linker generates the final ELF file. I’ve written a list of items I have had to modify in the KOS codebase in order to get it to compile on more recent gcc versions. I wonder if it would be worth publishing the specifics, or if anyone would ever find the information useful ? Oh, who am I kidding ? Of course I’ll write it up, perhaps publish a new version of the code, if only because that’s the best chance I have of finding my own work again some years down the road.

    Problematic C Code
    See if this code makes any sense to you. It somehow traverse a list of 32-bit function pointers (in different directions, depending on constructors or destructors), executing each in turn. However, it appears to fall over if the list of pointers consists of a single entry.

    C :
    1. typedef void (*fptr)(void) ;
    2.  
    3. static fptr ctor_list[1] __attribute__((section(".ctors"))) = { (fptr) -1 } ;
    4. static fptr dtor_list[1] __attribute__((section(".dtors"))) = { (fptr) -1 } ;
    5.  
    6. /* Call this to execute all ctors */
    7. void arch_ctors() {
    8.     fptr *fpp ;
    9.  
    10.     /* Run up to the end of the list (defined by crtend) */
    11.     for (fpp=ctor_list + 1 ; *fpp != 0 ; ++fpp)
    12.          ;
    13.  
    14.     /* Now run the ctors backwards */
    15.     while (—fpp> ctor_list)
    16.         (**fpp)() ;
    17. }
    18.  
    19. /* Call this to execute all dtors */
    20. void arch_dtors() {
    21.     fptr *fpp ;
    22.  
    23.     /* Do the dtors forwards */
    24.     for (fpp=dtor_list + 1 ; *fpp != 0 ; ++fpp )
    25.         (**fpp)() ;
    26. }
  • Revision 30966 : eviter le moche ’doctype_ecrire’ lors de l’upgrade

    17 août 2009, par fil@… — Log

    eviter le moche ’doctype_ecrire’ lors de l’upgrade