Showing posts with label alsa. Show all posts
Showing posts with label alsa. Show all posts

Thursday, January 12, 2012

Small, but Spicy

To save space on the zipit jffs, I made some small (but spicy) SALSA builds of amixer and alsamixer to replace the bloated static full ALSA build of alsactl from IZ2S.  That change freed up 200K on the jffs and eliminated a second or 2 from the ALSA setup part of the boot process.  Apparently the lean and nimble amixer program enables the sound much quicker than the fat old alsactl beastie.  The salsa version of alsamixer forces you scroll off to the right through the controls for quite a few screens before you get to the good stuff, but other than that it works pretty well.  As you can see in this screenshot of me, preparing to turn down the zipit speaker from it's ear blasting default of 100%.

While I was at it, I also compiled a shared lib version of the own-tty program for a 150K savings over the static IZ2S build.   The new one is only 4K.  Nice!

Meanwhile, upon further testing I discovered the pmirc script from last week had quite a few runtime requirements for utility programs only available in the busybox upgrade from the IZ2S.  Oops.  So I set about hacking the script to eliminate some unneeded utilities, and building the others.  After some time relearning sed and regular expressions, I managed to replace tr, cut, and clear with sed and ANSI escape codes.  I built a much smaller 11K shared lib version of nc to replace the big static build from IZ2S.  To make things easier for me I adjusted the help messages to fit the zipit screen, and tossed in a tiny telnet wrapper script.  (I also built a small 7K copy of NetKitty but haven't done anything with it yet.)  I've been searching for a while, and finally found a tiny 5K non-busybox version of the date program on the internet.  I modified it a teeny bit to add /etc/TZ file handling for local timezone formatting.  This lets pmirc timestamp it's log files with the local time.  I still gotta make a setup script with well known city name hints so it's easier to get the right setting into the /mnt/ffs/etc/TZ file.  Here you can see annonymous zipit_user_20645 using the 5K new pmirc utility on the jffs to join the #zipit chat group.  Probably just gonna lurk for a while...
While I was working on the date program I also built a tiny 5K cal program so I can now run the entire wifitest demo dialog script off the stock busybox.  Plus, someday when I get the gmu sqeezed into the jffs I hope to be able to set aside a zipit to be used as a dedicated alarm clock (internet) radio gizmo.

Anyhow, with both rockbox and the IZ2S busybox upgrade installed, I now have nearly 600K free on the jffs for other goodies.  I'd really like to have the zipit16.mp3 file I rescued from the resources.arl file play the "ZZZZipit!" sound on boot up.  But it's 80K and I've only been able to prune mpg123 down to about 230K, so that's unlikely for the time being.  I'm considering upxing the 600K wpa_supplicant program from the stock jffs to see if I can squeeze 100K out of it.  And the loadkeys program is also a heavy load.  Wejp went with the much leaner loadkmap on his zipit userland.  It only loads binary keymap files that must be created with loadkeys on a full linux system, but hey, that's another tradeoff I'm willing to make for 200K or so.

New stuff:
mixer-irc.tar.bz2

Sunday, April 10, 2011

A new day brings some new stuff for an old IZ2S.

Remember that bit about the double trouble?  Well, forget it.  Sometimes I have no idea what I'm talking about. 

I still don't really know what prevents me from puting a working libasound together.  It could simply be one of the zillions of ALSA config files is busted for all I know.  However I was successful with the salsa embedded ALSA lib.  I managed to build it and actually got some test programs from a beat up old Linux Journal to work.  I played with these for a bit, did some reading about "safe ALSA", and compared the way SDL wanted to use ALSA to the working mpg123 and aplay executables.  It turns out the simplistic buffering strategy used by SDL is probably ok for games, but not so good for gapless music playback on a stressed out low MHz linux box (like the zipit running IZ2S).  So I mercilessly hacked the SDL_alsa_audio.c file to make it behave more like the other programs.  Then I built a new libSDL with my changes, and with the tiny salsa library built right in. 

If you like, you can replace the old libSDL in IZ2S with sdl-salsa-iz2s.zip.  Then set SDL_AUDIODRIVER=alsa instead of dsp and go.  I recycled some rather under-utilized SDL_ALSA environment variables, just in case you want to play around and adjust the buffering scheme.  These are (lightly) documented in a text file included with the lib.

I also put together a real gmu-0.7.2-iz2s.zip package with the new libSDL since it no longer skips on IZ2S.  I must say GMU is really handy for debugging the audio code.  It's well written and easy to follow, unlike the gigantipus that is rockbox. 

I happen to like rockbox though.  So I rebuilt the IZ2S version with a more recent branch of code.  It has better (but not quit perfectly smooth) battery monitoring.  It can now change codecs on the fly and it no longer needs to move config files in and out of the /tmp directory.  It also seems to quit after 10 minutes on pause.  Perhaps that might help with the IZ2S power management?  I also let it use the standard linux file structure which prefers to install in the /usr/local directories instead of the embedded setup using the /.rockbox directory.  I'm not sure how much I like that, but for now it lets me keep the old and new versions installed at the same time for testing.  Here it is.  rockbox-iz2s-t11.zip

Finally, here's an ebindkeys executable for IZ2S with a setup to make the home key launch rockbox.  That's a single easy to find button so I can start it up in the car at night without turning on all the lights.  And here's another tip for the car.  Add a line to the startup script to soft link your music directory to /audio so it's right at the top of the rockbox file browser for quick and easy access.


Update:  It's a bit trickier to install rockbox themes on the new release.  You'll need to CD to the share directory on your SD card and temporarily rename the rockbox directory in there to .rockbox.  Then you can unzip an Ipod Video theme into the .rockbox directory.  Rename it to back to rockbox and you're done.

Also, unlike rockbox GMU only allows one key binding per function.  With the wide variation in default key mappings among IZ2S versions, this means that sometimes the volume is controlled via the +/- keys on the side of the zipit, and sometimes you'll have to use the prev/next keys.   So if you're using IZ2S 2.04 with it's default keymap and you want the volume controls on the side then you should edit the gmuinput.z2.conf file and near the bottom replace this:

Button73=280,Volume+
Button-74=281,Volume-


with this:

Button73=270,Volume+                                                                         Button74=269,Volume-
                                                                                                     
I suppose I could try to patch the code to work around this limitation.  Or maybe distribute several different GMU config files with the package.  I'll make a decision someday...