Sunday, October 19, 2008

Wireless connection from the command line

If ever you find yourself stuck with a *Nix box that won't boot into any kind of comfy graphical interface, and you need to connect to a wireless internet connection so that you can look stuff up and maybe solve your problem, here's a helpful tip:

There is a wireless networking utility very much like ifconfig called iwconfig. When you have a chance (and preferably before you really need it) check out the man page for it. Here are some quick and dirty instructions, in case you are desperate right now.

To find out what wireless networks are available to you, type
iwconfig wlan0 scan (see comments)
iwlist wlan0 scan

To attach to an open, non-encrypted network, type
iwconfig wlan0 essid netname
where netname is the essid of the network you want to connect to.

If you only have encrypted networks available, you might be in a bit more trouble. I haven't actually managed to get that working at all yet, though theoretically, it should work something like this:
iwconfig wlan0 key s:password
iwconfig wlan0 essid netname

where password is your password and netname is the essid of the network you want. The s: means that the password is in string format. If you know the hex version of your password, then instead of saying s:password you'd just type in the hex of the password like this:
iwconfig wlan0 key 0123-4567-89

Good luck getting your GUI fixed!

Sunday, October 12, 2008

Stealing from Ubuntu to pay Midinux

I'm busy trying to get an application to work on Midinux MID devices. There's a problem, though, because a chunk of libraries that I need are not available in Midinux for some reason. So, I'm snagging the libraries I need from the Ubuntu os I'm running on my desktop and converting them to run on the MIDs with Midinux. I can do this because, for reasons I don't understand at all, Midinux is compiled as an i386 system even though it's sitting on a Mobile Internet Device with an Atom CPU (that's lpia architecture, in case you didn't know).

You can find lots of debs (those that you have installed on your Ubuntu desktop, that is) in /var/cache/apt/archives/ . The advantage of that is that you don't have to go hunting very far. If you can't find the deb that you are looking for there, try searching

Once you have the packages that you need, go ahead and change the debs into rpms using Alien. The command looks like this:
> alien --to-rpm the-package.whatever.deb

With that done, stick the package someplace where you can download it to your Midinux device, then pop over into the X-Terminal and into the directory where the rpm you need to install is sitting. Install the rpm with:
> rpm --install the-package-whatever.rpm

And there you go!

Tuesday, October 7, 2008

Ahhhh... This place has PACKAGES

Having gotten my blasted scratchbox working, I didn't seem to be any closer to compiling anything. I needed several packages and they weren't in the default packages available in the initial set up. Why, o why don't they give you any useful repositories right from the start in your scratchbox setup? I mean, COMEON!

So, the good news is that Hacking the N810 pointed me in the direction of which is now officially my second savior of the day (right after Gnuton).

At I was able to search for the packages I was looking for, find out what repositories they live in and set up my /etc/apt/sources.list in the scratchbox accordingly.

Just remember, you have to set up configuration files like the /etc/apt/sources.list for EACH target you are running in scratchbox, especially if you plan to be doing cross compilation.

Maemo Scratchbox Hell

That was SO much harder than yesterday. So, maybe it wasn't the same problem.

When trying to install the maemo-sdk-runtime in the ARMEL target of my scratchbox, I kept getting this HUGE error that started
[sbox-DIABLO_ARMEL: ~] > fakeroot apt-get install maemo-sdk-runtime
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
27 not fully installed or removed.
Need to get 0B/1890B of archives.
After unpacking 32.8kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
Install these packages without verification [y/N]? y
/scratchbox/tools/bin/sh: line 1: /usr/sbin/dpkg-preconfigure: No such file or directory
Selecting previously deselected package maemo-sdk-runtime.
(Reading database ... 16920 files and directories currently installed.)
Unpacking maemo-sdk-runtime (from .../maemo-sdk-runtime_1.0_all.deb) ...
Setting up gconf2 (2.16.0-1osso14) ...
/scratchbox/tools/bin/chown: `messagebus:messagebus': invalid user
dpkg: error processing gconf2 (--configure):
subprocess post-installation script returned error exit status 1

and ended
E: Sub-process /scratchbox/devkits/debian-etch/bin/dpkg returned an error code (1)

I'll now list ALL the things that it took to get this working...

Let us start with /etc/sysctl.conf
add the lines
vm.mmap_min_addr = 4096
net.ipv4.ip_local_port_range = 1024 65535
vm.vdso_enabled = 0

to this file. I recommend doing a search for each of those setting before you add the new lines. If you have the settings in there, comment them out, and then put the changed setting directly underneath with a comment about WHY you are doing this. (That's to save you heartache later if it breaks something else.)

Next, I ran apt-get install -f in both my normal shell and in the scratchbox. I used apt-get autoremove to get rid of some no-longer-needed packages in my regular shell.

Gnuton reported several problems and fixes and although I didn't have his 'messagebus:messagebus': invalid user problem I still did
cd /var/cache/apt/archives
fakeroot dpkg -i *dbus*

in the scratchbox, just in case.

Finally, I followed his advice and did
cp /usr/sbin/dpkg-preconfigure /scratchbox/users/lisha/targets/DIABLO_ARMEL/usr/sbin

and finally the &$%#! fakeroot apt-get install maemo-sdk-runtime worked.

Sometimes I just don't learn

I created this blog for the specific purpose of saving me from my own terrible memory. Again and again I get myself into deja vu situations where I can distinctly remember getting into this problem before, but I can't remember hoow I solved it. The number of times that has happened has dropped precipitously since I started blogging my most annoying problems here. But, despite that fact, I managed to forget how really important it is to my learning process to write these things here.

Yesterday, my maemo development scratchbox and I had a little disagreement regarding available packages and repositories. In the end, I solved the problem, but only in the i386 target. Today I cant get the armel target to work and I have no idea what the fix was yesterday. This is a serious pain.

Not to worry, I was better than the problem yesterday, and after wasting a bit more time, I shall beat it again. When I do, I'll be sure to blog the solution here.

Thursday, October 2, 2008

Thoughts on MID's

MID stands for Mobile Internet Device.

These devices are small tablet computers, some with and some without a physical keyboard, that allow you to connect to the Internet and run a number of applications in miniature versions. Some smart phones are basically MID's that happen to also be phones. I'd put the iphone into that category, as well as any phone with a screen that size and equivalent functionality. So, in my book, the Nokia N80 doesn't count (too small of a screen for comfortable web-browsing) but the HTC Android phone does count. My broad description, including phones, is not necessarily canonical. I do think that it's logical, however.

These devices generally have a browser, some sort of IM/chat facility, some sort of office document reader and sometimes document editors, a music and/or video player, and games. Some MID's run a version of Windows Vista. Others run a version of Linux. Of course, if you know me at all, you know that I want Linux on my MID, because I want freedom (as in speech) with my software as much as is possible. The good news is that it's possible to run a version of Linux on nearly all MID's today thanks to the work of groups like So, knowing that, what's really important in an MID?

There are a few harware things that I think are vital. A usable keyboard is way up there, in my estimation, although a really good *handwriting recognition interface would satisfy me just as well. A **screen size that allows for easy reading is important, too. A camera is nice, but not vital, since my main digital camera is generally on my cell phone.

Software-wise, I don't want to be hobbled. I don't want the system to lock me out of the terminal window, or force me into contortions of geekish heroics just to install non-approved software. I don't want Big Brother telling me what I can and cannot run on my MID. It's mine, gosh darn it. If I bought it, I want to use it however I choose. Can you imagine buying a refrigerator and being told that your warranty would be void if you chose to refrigerate any non-food items? What if you choose to refrigerate photographic film? Or pre-cool glasses so that you can have a proper cold one?

The Samsung Q1 is my favorite device in terms of screen size and heft. I feel like I could get WORK done on that thing, as well as play, read RSS feeds on the way to work and otherwise do most of the tasks that make up most of my non-programming computing life. What I don't like about it is the keyboard. Actually, the keyboard is ALMOST right. The placement under the user's thumbs at the top of the screen is fantastic, but it's just too hard to do shifting and number typing. Fix that, and the Samsung Q1 running an imaginary version of Moblin would be first choice all around.

I've played pretty extensively with the Lenovo ideapad U8, and I'd really *like* to like that device, too, but it just doesn't cut it for me. If I spoke and wrote Chinese as my primary language, my opinion would probably be a bit different. The stroke-based keypad on the telephone dial pad is probably a comfortable way to type Chinese. If you've done much smsing, though, you already know what a pain that kind of keypad is for extensive entry in most other writing systems. The fact that the midinux software on the device is super hobbled is also a pain. In early versions of the device you couldn't even get a terminal window unless you know the "cheat code", so to speak. (Ctrl-alt-backspace and then F2) In later versions, at least you'll have an x-terminal available by default. Still, the packaging system is wonky, and the GUI is funky and uncomfortable.

You may have noticed that when I was talking about the Samsung Q1 I wanted an imaginary version of Moblin. Well, that's a thing, see? Moblin just isn't what it could be, yet. I'm personally not all that thrilled about the fact that they've just changed from a debianish system to a red hattish system, either, but that's beside the point. The problem with Moblin on the devices that I've tried it with has been far more basic than that. The applications just aren't quite there yet. They, almost without exception, get things wrong when converting their interface into the smaller space. Buttons don't show up right. Text inputs get messed up. Scroll bars are in the wrong places or not there at all.

One of the biggest problems across the board with Moblin apps and system controls is that they are unaware of whether the screen keyboard is being used. That means that they hide important dialogs and even buttons under that keyboard in the screen real estate, and you simply can't DO anything. The only solution is to plug in an external keyboard to get some tasks done.

So far, the best all around experience I've had has been with the Nokia N810 running the new maemo version, 4.1.1 Diablo. It was easy to find and get software. It was easy to get into a terminal window and easy to do things there. The pull down keyboard was comfortable in my hands and I was able to type fairly quickly with it. The touch screen worked well, and the applications were lovely. I didn't see any of the problems that I've encountered with Moblin apps, which makes me wonder why there maemo apps aren't being ported to Moblin instead of desktop apps getting Moblinized.

I've got this fantasy of a cell phone/MID device that will be bigger than the Nokia N810 but smaller than the Samsung Q1, have enough storage to make it useful as a multimedia device, run on Intel ATOM architecture or an equivalent for power and speed, have a usable keyboard AND handwriting recognition, a camera on the back (they are so useful for things like barcode reading!) and bluetooth so that I can connect an earpiece. Of course it will have wifi and 3G, because let's face it, there's no reason I should have to carry BOTH a telephone and this little baby, when I can have it all in one. Seriously, with a bluetooth earpiece it doesn't matter how big the device running the 3G connection is, and you really shouldn't be talking with the phone up to your face anyway! This device would either run maemo, which I think is an absolutely lovely OS, or else Android, which makes me all weak in the knees and giddy with excitement at the thought.

When this device is born I will love it, take good care of it, and write software for it. It'll come with me on the bus and on the plane and in doctor's and vet's waiting rooms. It will sit with me in coffee shops, and hang out with me on the couch in my living room. I think I've been dreaming of this device since I was a kid, while sitting in front of the tv, watching endless Star Trek reruns. I'm wondering when I'm going to get to adopt buy one.

*Am I the only one on the planet who misses the Palm Graffiti?

**I think I'm killing my eyes reading RSS feeds on my way to work on the tiny N80 screen.