Productivity Sync

March 22, 2010

Android Platform hacking

Filed under: Uncategorized — markgross @ 7:17 pm
for b in `find . -name '*.mk'`; do grep -i phony $b; done
repo forall -c "git log  --format=%H --committer=google.com --committer=android.com -1  | xargs git checkout"
make kvm_img
VBoxManage convertdd kvm.img kvm.vdi

March 21, 2010

Starting with Pd

Filed under: Uncategorized — markgross @ 6:41 pm

Pd is an audio centric data graph processing program with the worst UI ever.  GEM graphics based UI’s are awful!

Its popular in electronic music communities, and its one of those programs that has hidden documentation.

Tips:

  1. left click in an empty part of the window, and select help to get a list of “object” types you can create.
  2. You have 5 types of elements you can manipulate in the “GEM” interface, {object,message,number,comment,symbol}
    • objects: there a large list of these things.  Its not clear what abstraction to think of when working with them.
    • Numbers, are not clear
    • Symbols, look like numbers but its not clear what the heck they are.
    • comments, are clear.
    • messages are also mysterious too.
  3. “control e” toggles the window in focus between edit mode and run mode to drive the graph you set up.

    OMG the UI is total crap, under linux anyway, I can’t understand why is so bad.

    February 21, 2010

    recordmydesktop can suck my balls.

    Filed under: Uncategorized — markgross @ 2:07 pm

    WTF is it with this stuff? Do I *always* have to piss away 3 hrs getting something to work correctly?

    recordmydesktop is a screen casting tool for recording audio and screen activity into a type of lecture.

    out of the box lip sync is all fucked up. After screwing around with it and trying it on multiple computers I lucked out and found another blog that had most of what I needed. (google for “recordmydesktop broken pipe”) One of the hits is the one I used (thefunkcorner… “trials-with-recordmydesktop.html)

    Anyway some of that didn’t apply to my hardware and after some more screwing around the magic command line to get a good screen cast with good lip sync is the following.

    recordmydesktop --fps 5 --freq 44100 --buffer-size 65536 -device plughw:0,0 --windowid 0x1600003

    You get the windowid using the xwindows command:

    xwininfo

    BTW for the screen cast of the console window session it gave me a data rate of 53KBS. Expect a file size of about 3MB per min out of the box.

    February 20, 2010

    Using ipython and numpy to do simple linear algebra computations

    Filed under: Uncategorized — markgross @ 5:16 pm

    Every once in a while I need to solve a linear equation and I spend WAY too much time farting around looking for how to do it or attempting to do it by hand. (at one time I have programmed these things but I have long forgotten the details…)

    Anyway enter ipython and numpy:
    run ipython and have at it:

    ipython -p numeric

    import numpy
    M = numpy.matrix([[a11, a12],[a21,a22]]) # the aij are Floats.
    b = numpy.matrix([b1,b2]).T # the bj are floats
    numpy.linalg.solve(M,b)

    easy peesy.

    while your at it if you want to make a graph try:

    x = array([float(i)*pi/200 for i in xrange(1000)])
    y = array([float(i)*pi/100 for i in xrange(1000)])

    plot(x,sin(x),x, sin(y))
    plot(sin(x), sin(y))

    February 15, 2010

    Beagleboard adventures

    Filed under: Uncategorized — markgross @ 11:07 am

    I spent some time this weekend bringing up rowboat Android (Donut) and OpenEmbedded Angstrom beagleboard-demo-image up.  The following are notes/links for this effort.

    Rowboat:

    http://code.google.com/p/rowboat/

    http://code.google.com/p/rowboat/wiki/Main

    http://code.google.com/p/rowboat/wiki/ConfigureAndBuild

    The configure and build instructions pretty much just worked. I did need to install uImage package so I could build the kernel in the proper format. FWIW the build took about 1.5hrs for everything.

    Configuring the uboot flash values and booting I used:

    setenv bootcmd 'mmc init; fatload mmc 0 84000000 uImage; bootm 84000000'
    setenv bootargs 'mem=256M androidboot.console=ttyS2 console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw init=/init rootwait omapfb.video_mode=640x480MR-16@60'
    Beagleboard# saveenv
    Beagleboard# reset 
    

    The usb requires a hub for the keyboard mouse or event USB2ETH dongle to work.  The system boots and was not too bad.  The power management was anoying so I disabled it by setting the screen off time out to “never”.  The Pegasus USB2ETH dongle failed to work.  I think the kernel is misconfigured but as OE failed in a different way WRT network I can’t say for sure what the deal is.

    FWIW I was impressed with the software graphics performance.  This image doesn’t include the PVR grahpics driver that needs to be downloaded from TI separtaly

    Open Embedded Angstrom beagleboard-demo-image

    holy shit this is a LONG build with a lot of slow downloads.

    bitbake beagleboard-demo-image, is a big build too it took up 74,438,612 K of disk, There was some problems with building gimp and some of the extra locals, I had to hack some of the recipes a bit to get around.  When building with all the downloads already cached its a 7.6hr build on a 3Ghz, dual core box with 6MB L2 cache per core system.  (its a pretty fast box).  I even had PARALLEL_MAKE = “-j 2″ and BB_NUMBER_THREADS = “2″.

    diff --git a/recipes/images/beagleboard-demo-image.bb b/recipes/images/beagleboard-demo-image.bb
    index d83281c..b6e43df 100644
    --- a/recipes/images/beagleboard-demo-image.bb
    +++ b/recipes/images/beagleboard-demo-image.bb
    @@ -1,6 +1,7 @@
     # Demo image for beagleboard
    
    -IMAGE_LINGUAS = "de-de fr-fr en-gb en-us pt-br es-es kn-in ml-in ta-in"
    +#IMAGE_LINGUAS = "de-de fr-fr en-gb en-us pt-br es-es kn-in ml-in ta-in"
    +IMAGE_LINGUAS = "en-us"
    
     XSERVER ?= "xserver-xorg \
     xf86-input-evdev \
    diff --git a/recipes/tasks/task-beagleboard-demo.bb b/recipes/tasks/task-beagleboard-demo.bb
    index f9867af..27a411a 100644
    --- a/recipes/tasks/task-beagleboard-demo.bb
    +++ b/recipes/tasks/task-beagleboard-demo.bb
    @@ -22,11 +22,10 @@ RDEPENDS_${PN} = "\
     gecko-mediaplayer-firefox-hack \
     hicolor-icon-theme gnome-icon-theme \
     jaaa nmap iperf gnuplot \
    -    abiword-meta \
    -    gnumeric \
    -    gimp \
    +#    abiword-meta \
    +#    gnumeric \
     powertop oprofile \
    -    pidgin \
    +#    pidgin \
     #    irssi \
     mplayer \
     gnome-games \
    

    Configuring the uboot boot loader to do the right thing:

    setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait omapfb.video_mode=1024x768MR-16@60'
    setenv bootcmd 'mmc init; fatload mmc 0 84000000 uImage-beagleboard.bin; bootm 84000000'
    saveenv
    reset

    February 14, 2010

    Ubuntu 9.10 on the Acer 4810T (Timeline)

    Filed under: Uncategorized — markgross @ 11:06 am

    Post ubuntu 9.10 x86_64 install fix-ups

    What didn’t work:

    • brightness control
    • audio input
    • mouse pad annoyances
    • mouse pad on/off button works.  But only one time per boot, then no-mouse :(

    Fixes

    • brightness control:
      • edit /etc/default/grub.  Add “nomodeset acpi_backlight=vendor” to GRUB_CMDLINE_LINUX_DEFAULT.  (then run update-grub to make it stick)
    • audio input:
      • apt-get install linux-backports-modules-alsa-karmic-generic, then reboot
      • This fixes the sound recorder application but skype is still busted.
      • also some fiddling with alsamixer was needed (but I didn’t take notes on that.)
    • mouse pad annoyances:
      • to stop the god-damn menu pops from happening I hacked my .bashrc to hit ” synclient clickfinger2=0; synclient clickfinger3=0; synclient maxtaptime=0; synclient maxdoubletoptime=0″
      • I’m sure there is a better way but I don’t want to waist my time looking for it.
    • mouse pad on/off button.
      • edit /etc/default/grub.  Add “i8042.nomux ” to GRUB_CMDLINE_LINUX_DEFAULT.  (then run update-grub to make it stick)

    Refrences:

    https://help.ubuntu.com/community/AspireTimeline/Fixes

    February 13, 2010

    How to disable anoying menu pop ups on new laptop

    Filed under: Uncategorized — markgross @ 8:58 am

    When typing on my laptop my palm touches the mouse pad and frequently I get some f-ing menu that comes up and pisses me off, or worse cause me to lose data.

    synclient clickfinger1=0
    synclient clickfinger2=0
    synclient clickfinger3=0

    turns that BS off.

    February 7, 2010

    repo hacking and python reverse engineering

    Filed under: Uncategorized — markgross @ 7:52 pm

    Adding a format-patch feature to the Android repo program

    repo is the SCM tool for the google android project its basically a git try aggregator written in python.  Its ok, but when porting Android to a new platform you may want to generate patchsets of your changes of a well defined baseline.  The android project has a way of defininging baselines.  The manifest XML files contain a listing of all the projects, git tree paths, and optionally sha1 git object hashes for the defined version.  For instance there is a file eclair-20091115.xml that defines what the exact code base is for the November 15 2009 posting of the eclare code base.

    It is useful to be able to extract the patch-sets from the port and distribute the enabling as a small patch set.  Hence the need for a format-patch feature.

    The rest of this port is a combination of reverse engineering tricks and documentation of how the repo program is cobbled together.  Its mostly for me so I can remember what I did, but more importantly how I figured it out enough to make it mostly work.  (and what tripped me up)

    • Find __main__, grep -r __main__
    • see _Repo class, and its _Run function.
    • look closely at _Repo.__init__() what’s that all_commands all about/
    • oh, all_commands gets imported from subcmds!  Why, thats a directory with a __init__.py file.
    • looking at subcmds/__init__.py we see an itteration over all the *.py files in that directory, that fills a dictionary “all” with classes defined (with the proper naming convention WRT the *.py filename…)
    • These subcmd classes need to each be a subclass of Command, and include an Execute function, to be called by _Repo._Run()

    Now to find out how code was getting called I stooped to sprinkling print commands, pdb, and ipython loading of selected parts of the program.  I’m sure there must be a better way of doing this sort of thing but this is what I did.

    • first looked at how similar repo commands worked.  (like repo diff)
    • grep for diff, see project.py has hits.  /me takes a closer look.
    • Also, recall how subcmds work, take a look at subcmds/diff.py

    At this point I should point out the ctags -R * works for python programs.  you want the tags when brousing the code.

    • ooh, see PrintWorkTreeDiff() in project.py its a function in the Project class.
    • At this point I want to know what are the members of the Project class instances.  How do get that data, (ipython is my friend…)
    • Two ways to go at this point pdb and print out selected arguments that get passed to constructors we care about.
    • stick import pdb and pdb.set_trace() in the Execute function in the subcmds/diff.py file
    • use bt, up, and p to see arguments passed into run command.
    • also see that the _Repo() class instance is created by passing the path to the .repo directory.

    Now lets go to ipyton and do some poking around.

    • cd the .repo/repo and start ipython.
    • import main
    • repo = main._Repo(‘blaba/.repo’)
    • see that repo._run(argv) sets up a cmd from the dictionay all_commands, lets look at one of those guys
    • diff = repo.commands['diff']
    • lets look at what’s in this guy…
    • see that GetProjects() basically returns the self.manifest.projects in a list.  Looking around we see that the command.manifest is setup in _Run()
    • lets look at that, cmd.manifest = XmlManifest(cmd.repodir)
    • I now know I need one of these for the Baseline.  Lets subclass the XmlManifest do create my baseline manifest so I can get all access to all the goodies in each of the projects in that list.
    • but first lest look at what’s in a project.
    • man = main.XmlManifest(repo.repodir)
    • print man.projects.  Hmm its a dict.  with keys from the xml file.  lets look at one to the project  ojiects…
    • p = man.projects['GAID/platform/packages/apps/Sync']
    • p. tab and look around at what we have.
    • lets try p.PrintWorkTreeDiff()

    Ok, at this point I have a good bead on how this guy works.

    To do my feature I need to add a function to Project, to do git format-patch, add a subclass to XmlMainfest for the baseline manifest files, and a subcmd/format-patch.py with a FormatPatch subclass of Command.

    So working with python comes down to a combonation of reading code, using pdb, ipython and perhaps some print’s in the code.

    Nothing too magical, but these are what I needed to do.

    Gotcha: when using subprocess, be sure to make every argument not have any spaces!  I got wrapped up with subprocess.call(['git','format-patch','--output-directory /home', rev]) only to finally figure out that the the 3rd parrameter should be the 3rd and 4th ones.  one trick is to use strace to see what the list should be:

    strace -e trace=execve git format-patch –output-directory /home/mgross to see what should be passed in.

    Handy bdb commands: help, n, up, down, s, l, p

    its not too good at introspection.

    December 27, 2009

    Linux From Scratch guest under VBox

    Filed under: Uncategorized — markgross @ 7:04 pm

    Network setup:

    ls /sys/class/net to see what devices the system thinks you have.
    I have eth1 and lo

    edit /etc/sysconfig/network-devices/ifconfig.eth1/ipv4 to look like:

    ONBOOT=yes
    SERVICE=ipv4-static
    IP=10.0.2.15
    GATEWAY=10.0.2.2
    PREFIX=24
    BROADCAST=10.0.2.255

    Then add your names to /etc/sysconfig/network

    HOSTNAME=lfs

    and update resolv.conf:

    domain lfs
    nameserver 10.0.2.2
    nameserver 192.168.140.1 <–HACK I needed to get it working for my system.
    I’m pretty sure I’m doing something wrong to need this, or the NAT from the
    VBox doesn’t do dns routing to the host.  This problem should go away once
    I change things to DHCP within the LFS guest.

    then update hosts file

    127.0.0.1 localhost
    10.0.2.15 lfs.vbox
    10.0.2.2 vbox

    after all this running /etc/rc.d/init.d/network restart gave me a working
    network with DNS support.

    Random LFS notes:

    you *really* want to have screen installed and use it (Learn it.  Love it).
    you also want to boot with the vga=ask option and with a kernel that support
    vesa frame buffers to get something better than a 25×80 text window.

    Virtual Box PXE boot with serial console

    Filed under: Uncategorized — markgross @ 6:47 pm

    Some notes on working with VBox as a PXE test target for booting test linux kernels….

    (BTW linux-next-20091224 fails to boot for me)

    Step 1:

    get tftp-hpa installed.  (you don’t need the daemon.  just the program)

    Step 2:

    set up the pxe directory root.
    mkdir $HOME/.VirtualBox/TFTP
    mkdir $HOME/.VirtualBox/TFTP/pxelinux.cfg

    Step 3:

    Copy pxelinux.0 to $HOME/.VirtualBox/TFTP
    make symbolic link to pxelinux.0 named <guest-vmname>.pxe.
    i.e. ln -s pxelinux.0 LFS.pxe

    step 4:

    copy kernel and perhaps initrd to $HOME/.VirtualBox/TFTP
    cp /boot/*2.6.32* .

    step 5:

    edit $HOME/.VirtualBox/TFTP/pxelinux.cfg/default
    mine looks like:
    LABEL linux
    KERNEL vmlinuz-2.6.32
    #APPEND root=/dev/sda2
    APPEND root=/dev/sda2  console=ttyS0,115200n8 vga=343
    #APPEND initrd=initrd.img-2.6.32 root=/dev/sda2 console=ttyS0,115200n8

    Notes on getting a serial output from Virtual box guest and host over named pipe:

    from the VirtualBox GUI for guest settings select Serial Ports:

    enable com1, with port mode Host Pipe.
    enable create pipe
    set pathname for pipe.
    e.g. /home/mgross/vbox_tty

    connecting to this pipe:

    socat:

    socat unix-listen:vbox_tty,reuseaddr,fork -
    socat UNIX-LISTEN:vbox_tty -
    see: http://www.reactos.org/wiki/VirtualBox

    http://blino.org/blog/mandriva/virtualbox-pipe.html

    minicom:

    for minicom change the serial device to be the pipe using the unix# syntax.
    A -    Serial Device      : unix#/home/mgross/vbox_tty
    This worked for me.
    i.e. run minicom -s and then Serial port setup menu option and put unix#pipe_path

    I didn’t like the behavior of socat and it actually is one of the complicated
    programs to use with 2 zillion options.

    Older Posts »

    Powered by WordPress