Archive for July 29, 2009

Adios NetworkManager

Posted in acer aspire one, crunchbang, hardware, pulseaudio on July 29, 2009 by lucky

Tonight I finally got pissed off enough about losing wifi when not in X to ditch NetworkManager. Maybe, in an odd way, I’m kind of like Cheech and Chong when they “borrowed” a neighbor’s car and found its automatic transmission too complicated, but I find NM way more hassle than it’s worth. Probably brought to you by the same people who are simplifying audio with PulseAudio. I don’t get it, but I never had a problem with the “old” and “complicated” way. Then again, I actually read the fucking manual.

I haven’t installed wifiroamd yet because I’m not doing much roaming until my ankle heals. It’s easier with one network to deal with (just one wpa_supplicant configuration to set up) but that’ll change and I’ll have a couple more networks to set up. I may just use a series of scripts like I did when I was using OpenBSD on my other laptop — select an option for where I am, connect to whichever AP however I need to as needed rather than automatically connecting and potentially waiting a while to connect to multiple APs. I don’t know if wifiroamd is a better solution for that or if it’ll act like a desperate hooker trying to pick up any signal it can get while it ignores my own (see next paragraph).

In addition to being able to stream audio while in console (I have such odd tastes, eh), I noticed I’m finally below 140MB actual RAM after startx. I also noticed that there was none of the bullshit I’ve written about with associating with other APs before even getting to mine, which is the only one it should associate with. I know a lot of people don’t think twice about piggybacking but no wireless manager application should allow it by default — I think that kind of thing should require a user to choose an “any AP” setting or otherwise interact to allow it after searching high and low for a trusted AP.

I still can’t get over how many distros tie wifi to X by default now even though Linux distros are oriented for boxes and dials to set things up. I’m not really inclined to say this kind of thing because I try to stay open-minded about other systems, but that’s so Windows. Bunch of wussies.

A Sync Script for MTP Device

Posted in MTP, Samsung S3, libmtp, linux, mksh, my stuff on July 29, 2009 by lucky

I’m less concerned about managing albums on my Samsung S3 from within Linux than I am “changing” content like podcasts, images, shopping and to-do lists, etc. This is no problem at all in Windows because MTP is perfectly supported under it.

The S3 has a file structure which separates “datacasts” from other audio content. I’d been using a quick little script that would copy every ogg, mp3, and/or wma file in the current directory (specifically, ~/podcasts) to my S3’s Datacasts directory. It was fine for doing that, but I wanted it to do a little more than that so I could use one directory as a “sync” folder for more file types. Then I could move all content I want to that folder, run one script, and my podcasts would go to Datacasts, text files would go to Texts, and pics would go to Pictures; as I’ve written before, the device isn’t fine-tuned enough to automatically put each kind of file in an appropriate directory so I wanted my script to assure everything goes exactly where I want it. Otherwise I’d have to go to the “File manager” directory and trace through it to other folders to find my content. This way I know exactly where everything is.

One important thing to note about libmtp and mtp-tools (mtp-examples in Fedora) is that directories are referred by their ID numbers rather than their names. It’s easy to get the directory ID numbers for these using the mtp-folders command. For example, I used the following to get the “Pictures” directory:

% mtp-folders | grep -i pictures

This reported back the folder “Pictures” with an ID number 32776. Other MTP devices will likely have different ID numbers for different things so double check your own device before using the following script.

Once I had the relevant directory numbers, I could set up a few functions to send files to them through a case command for each file type I want to manage. Here’s the current version of my move_podcasts.sh script:

#!/bin/sh
# lucky13linux.wordpress.com - Wed Jul 29 14:33:14 CDT 2009

# moves files from PWD to MTP device via mtp-sendfile
# and deletes the file from PWD. Use this for podcasts,
# text files, and images rather than for music kept
# on the system. 

# mtp-folders for my Samsung S3
# 32773 = Datacasts
# 32774 = Texts
# 32776 = Pictures

function move_podcast_files  {
	mtp-sendfile $SYNC_THIS_FILE 32773
	echo "removing $SYNC_THIS_FILE from $PWD..."
	rm $SYNC_THIS_FILE
}

function move_text_files  {
	mtp-sendfile $SYNC_THIS_FILE 32774
	echo "removing $SYNC_THIS_FILE from $PWD..."
	rm $SYNC_THIS_FILE
}

function move_image_files  {
	mtp-sendfile $SYNC_THIS_FILE 32776
	echo "removing $SYNC_THIS_FILE from $PWD..."
	rm $SYNC_THIS_FILE
}

for SYNC_THIS_FILE in *
do
	case $SYNC_THIS_FILE in
		*.mp3)	move_podcast_files                                 ;;
		*.ogg)	move_podcast_files                                 ;;
		*.wma)	move_podcast_files                                 ;;
		*.txt)	move_text_files                                    ;;
		*.TXT)	move_text_files                                    ;;
		*.jpg)	move_image_files                                   ;;
		*.jpeg)	move_image_files		                   ;;
		*.JPG)	move_image_files		                   ;;
		*) echo "are you sure $SYNC_THIS_FILE goes to MTP device?" ;;
	esac
done

Nothing fancy, and someone will no doubt have a better solution (feel free to opine) or suggest moving some of the repetitive commands in each function to the for loop. It’s a work in progress and works the way I want. Caveats and additional points:

  • I use mksh and edited this to /bin/sh; change to suit your needs if /bin/sh doesn’t link to your preferred shell. EDIT (sorry!): That includes possibly having to edit the functions if your shell (e. g., CSH or TCSH?) uses C/POSIX functionname () {…} semantics rather than function functionname {…}.
  • Add or remove file types based on your own needs. I convert all my images to jpg for convenience.
  • I used single entries for each file type because I may end up adding more to the functions, e. g., adding custom id tags to mp3 and/or oggs (can’t add tags to wma in Linux as far as I know).
  • I haven’t bothered putting videos on my S3 even though it’s capable. I don’t even know if/how I can convert to the format Samsung requires videos be in to play on their devices. RTFM.
  • Delete the rm/echo commands in the functions if you want to keep local copies.
  • In my cheap original script for ogg, mp3, wma, I used ‘for FILETYPE in *.{ogg,wma,mp3}’ which resulted in error messages if one or more weren’t in the directory.
  • I’ll most likely add POD_SYNC_DIR so I can run the script from any directory or from a dynamic directory (dmenu or ion3’s F3 menu) which reads from $PATH. No big deal because I tend to wget files directly to ~/podcasts and always have a terminal open. Whatever.

Finally, mtp-tools (mtp-examples in Fedora) has the mtp-delfile command which is a bit clumsy. To remove files, I tend to delete them directly from the S3 after I listen or use gphotofs (fuse) to mount the device and delete or copy back files I want to keep. In fact, I highly recommend using gphotofs or other applications utilizing libgphoto2 for copying files from a MTP device back to a computer. Unfortunately, libgphoto2 doesn’t copy/move files and directories from computer to device or else it would be ideal, but it’s for cameras rather than media devices. Maybe the libgphoto people and libmtp people can do more collaboration and maybe even merge their projects for better all-around support of cameras and media players using PTP/MTP.

UPDATE 2009-07-29 20:01 CDT: Version 2 of the above script now does rudimentary logging which, when I’m finished, will maintain a list of the file ID numbers to (hopefully) ease removal of files without using the other utilities mentioned in the last paragraph.

Various Thoughts and New Stuff – 20090729

Posted in acer aspire one, hardware, linux on July 29, 2009 by lucky

I’ve found a couple new things that interest me over the past few days.

Acer Timeline

I saw this thin-looking laptop the other day that caught my eye because of the display for it. The display touted how thin it was (about an inch thick) and how long the battery life was (eight hours). I wanted to lift the laptop to see how heavy it was but these displays have tethers and bars to limit movement — or theft. I could get it only so far off the table but it felt pretty light, especially compared to my past full-sized laptops.

The Acer Timeline has a few models, with screens from 13″ to 15.6″ and Intel’s ultra low voltage Core2 Solo processors. The model I saw was the 15.6″ and also was spec’d with a DVD-RW, 3GB of RAM (expandable to 8GB, which requires 64 bit OS), and a 320GB hard drive; resolution on all models appears to be 1366×768. The display model I saw had clear and crisp graphics. These laptops also come with multicard readers. I didn’t see anything indicating onboard Bluetooth. The wifi card is Intel 5100 (abgN); I’m looking at upgrading my home network — and AA1 when its warranty expires — to 802.11-N, so this wouldn’t require any further upgrade when I make the switch. It also had a centered (as far as I can tell anyway; I’m on pain medications) touchpad and a full-sized keyboard. I initially hated the chiclet keyboard on my AA1, and the Timeline’s keyboard is quite similar. I still don’t care for the chiclet keyboard but it wouldn’t be a deal-breaker for me.

Here’s the deal about the battery life. You can only expect eight-or-so hours if you’re not running Aero (these models come with Vista Home Premium) and you’re running some kind of Acer power management utility. This power management utility seems to be CPU scaling and similar things to reduce power consumption. Fair trade off, but I honestly haven’t seen any staggering gain in battery life with CPU scaling on my AA1 — I get about two hours per charge regardless of using XP or Linux. YMMV, but mine hasn’t yet (and I run the most miserly applications I can get away with).

The Timeline caught my eye because it seems to be quite light (just over 5 pounds for the 15.6″ model) and because of the possibility of getting four-times the battery life I’m getting now. I wanted the AA1 because it was lighter and more portable than my aged ThinkPad, not to mention the fact that the AA1 completely outspecs the old ThinkPad. Short of battery life and small screen and small keyboard, the AA1 is suiting my needs quite well. But I do miss having a larger screen and I’d like to get used to using a full-sized keyboard again.

At about $600, the Timeline offers a lot more power and battery life than my AA1. I haven’t decided if or when I’m getting a new laptop or if I’ll keep using the AA1, but the Timeline will probably be on my wishlist. It’s not quite in the class of the Lenovo X300 or Macbook Air, but its price is about a third to a quarter of those models and its extra heft is at least in part due to having an optical drive. I could live with that kind of compromise whether I get five or six hours of battery life or the full advertised eight.

Sabayon CoreCD 4.2

First, I’m not crazy about the name “CoreCD” since it’s too similar to another project’s name. I don’t know if Robert Shingledecker trademarked the “Core” name or even “Tiny Core” but I don’t like it when others copy names of existing projects. Boo!

Second, I was unclear after reading the press release what differentiated CoreCD from Gentoo Stage 3. I found the following on Planet Sabayon in a 23 June entry:

It is designed to “sabayon-infy” a gentoo stage 3 by providing an simple text based installer and up to date packages, as well as a solid core upon which you can build with either entropy or portage.

Ahh, so it’s just Stage 3 done Sabayon style.

In the back of my mind I’ve been fighting an impulse to install a source-based distro like Lunar or Gentoo, or even building from scratch. Sabayon has been pretty easy to dismiss because, until now, the images have been big honking DVD ISOs — which I find, for some reason, quite ridiculous for a source-based distro to offer.

Now I have to add this particular release from Sabayon to the list of the things to quash in the darker recesses of my mind. Especially since I’ve already downloaded it.

One thing is certainly offputting enough to keep me from impulsively installing it: the hideous Red Curtains of Hell splash on the visual tour page on the Sabayon Wiki. I fucking hate splash as it is, but this thing looks like something from “Interior Decorating with Satan.”

Fortunately, that’s something that can be disabled and configured out of a system.

I wonder if I’ll end up installing this before I get a new laptop.