Paul's Cranium
At Sun, we have some of the brightest engineers in the industry. They think with incredible depth and clarity. Enough about them, though. You are about to embark on a journey inside my head. It may feel small at first, but you will adjust.
New to the Cranium? Check out entries my readers found memorable at Remember This
All | Nothing

20050614 Tuesday June 14, 2005

A Few of My Favorite Things
I have been using Solaris for a long time now.  In fact, I remember using Solaris 2.3 when it first came out, and I was glad to have it! I would have never imagined all those years ago that this great operating system would eventually be available with an open source license. As a long time user of Solaris as a desktop, I thought it would be fun to assemble a few desktop tidbits for your perusal.

Typing in the same language

I use the Dvorak keyboard.

When I tell people that, they generally make a comment about how great ergonomic keyboards really are.  Those 5 words have gotten me into the longest explanations about keyboard remapping you could possibly imagine.  Generally a full understanding of what I am talking about only follows when I invite the other person to try to type on my laptop.

To add to the confusion, there are companies out there marketing Dvorak keyboards as a separate thing that you plug into your computer.  The Dvorak keyboard is not hardware, but rather a different way of looking at the arrangement of keys on the keyboard.  This is a good thing.  While I love new hardware, imagine me walking around with my very slim Ferrari branded Acer laptop and a separate keyboard.  That is so much stuff that it doesn't fit on my lap, so I would need to put the laptop on a desk with the separate keyboard on my lap.  Now the laptop is so far away from me that I need to hook it to a larger monitor...  That puts me in need of a power strip so that I can simultaneously charge my laptop and drive the monitor while not hogging an entire outlet, should I be in a coffee house or other such public location.  Besides, with me now lugging about my desk, monitor, power strip, and keyboard it really wouldn't be much more trouble to bring along a photocopier, fax machine, and a lamp to fill out the entirety of my office needs.

No, this is clearly the wrong direction.  Mobile computing doesn't mean that you bring your entire office infrastructure with you - it means that you can work effectively with less than a full office.  That is the beauty of the Dvorak keyboard - it allows you to type with a more efficient keyboard mapping without additional hardware.

The letters on the keys don't match what the computer types when you press them.  It is confusing at the very least.  There are many good reasons why folks use the Dvorak keyboard.  I use it because it actually does eliminate hand and wrist pains when I type all day long.

As you might have guessed, my first tip has to do with changing the keyboard layout in Solaris.  There are two easy ways to do this - xdvorak and xmodmap.

I have used xdvorak for a very long time.  It is a program written in C that changes the X keyboard mapping using the XChangeKeyboardMapping from the Xlib library.  It has the advantage of being able to detect which keyboard is currently installed and when executed subsequent times it switches between Dvorak and QWERTY.

NOTE: When compiling xdvorak, you must be sure to use the -DXLIB_ILLEGAL_ACCESS compiler flag because it uses Xlib APIs that are not generally available to clients.

More recently I have taken to using xmodmap to install the Dvorak keyboard mapping.  This is very easy to do, and has the advantage that there is nothing to compile and you can easily customize the specifics of the keyboard to your liking.  Marcus Brooks has excellent mapping info on his site.  I used the Jeff Bigler mapping from that site on Solaris with no trouble at all.

A Picture is Worth ...

... nothing if you can't get it off of your digital camera.  This section focuses on techniques for reading USB memory devices and can hopefully improve the value of your pictures as they have for me.  Remember - without the ability to read the contents of your Compact Flash card, it is just expensive plastic that your camera requires to make that cute clicking noise when you take pictures.

Ok, go ahead and plug in your memory device into a USB port.  Be sure you are running Solaris 10 - our folks have done tons of work in this area that was put into the latest release.  No advantage to swimming upstream here.

Once your  memory device has been inserted, it is generally automatically mounted by vold(1M).  The mount point will be /rmdisk/rmdisk?, you have to check the date to be sure you have the right one.  If the memory device simply did not mount, restart vold [pkill -V as root, then restart with vold&].

So that's my big trick.  Plug it in and then look in the right place.  The more tricky part is when you want to unplug it.  If you are doing writes to the device and don't care about the contents or the need to reformat, go ahead - unplug it.  I dare you. :-)  Actually, it will probably be ok.  Your data will likely be fine.  Your pictures which cannot be replaced probably won't be damaged in any way.

If you are like me, using "probably" like that generally means that it isn't going to be ok. It would probably be worth learning how to remove the memory device without causing file system corruption that leads to data loss.

Removing the device is easy enough, but you have to unmount the device and get vold out of the way first.
    su root
    umount /rmdisk/rmdisk0
    pkill -V


Now use the cfgadm tool to figure out which USB  ID is associated with your memory device:

    cfgadm


Ap_Id                          Type         Receptacle   Occupant     Condition
usb0/1                         unknown      empty        unconfigured ok
usb0/2                         unknown      empty        unconfigured ok
usb1/1                         unknown      empty        unconfigured ok
usb1/2                         usb-storage  connected    configured   ok
usb2/1                         unknown      empty        unconfigured ok
usb2/2                         usb-hub      empty        unconfigured ok
usb2/2.1                       unknown      empty        unconfigured ok
usb2/2.2                       unknown      empty        unconfigured ok
usb2/2.3                       unknown      empty        unconfigured ok
usb2/2.4                       unknown      empty        unconfigured ok

#

In this case, the memory device is sitting on USB identifier "usb1/2".  Use that identifier to disconnect the device:

    cfgadm -c disconnect usb1/2

Now try the cfgadm command again to see that the device is actually disconnected:

    cfgadm


Ap_Id                          Type         Receptacle   Occupant     Condition
usb0/1                         unknown      empty        unconfigured ok
usb0/2                         unknown      empty        unconfigured ok
usb1/1                         unknown      empty        unconfigured ok
usb1/2                         unknown      disconnected unconfigured ok
usb2/1                         unknown      empty        unconfigured ok
usb2/2                         usb-hub      empty        unconfigured ok
usb2/2.1                       unknown      empty        unconfigured ok
usb2/2.2                       unknown      empty        unconfigured ok
usb2/2.3                       unknown      empty        unconfigured ok
usb2/2.4                       unknown      empty        unconfigured ok


It is now safe to unplug your memory device from the USB slot.


The Laptop Zone

We have probably all heard about Solaris 10 Zones (or containers) by now.  I certainly don't need to beat that drum, but I offer a twist to the usefulness of zones.  When applied to a laptop, Solaris zones can help solve otherwise tricky networking issues.

Imagine that you have a laptop that you use in a coffee shop, at home, and at work.  You drag the thing everywhere, so you have resigned to using DHCP for your network configuration.  Also, because you probably aren't using NIS or NIS+ at the coffee shop and possibly not even at your house, you might choose to not have a naming service when you configure your laptop.  This generic configuration is a good catch-all for a mobile device.

Unfortunately, this configuration can leave you hanging when it comes to full connectivity at work where you do have a naming service that everyone uses.  What if you want to use NIS at work and no naming service at all while at home?

Enter the Zones ... er ... zone.  With Solaris 10, you can configure your laptop to use DHCP in the global zone, and other more customized network configurations within other local zones.  While you cannot yet use DHCP in a local zone, you can configure a local zone with a static IP address and a different naming service type than the global zone is configured to use.

When you use the laptop at home, you can simply use the global zone with DHCP.  When you go in to work, simply boot the appropriate local zone (which consists of a naming service and a static IP address) and then ssh into that zone, set your $DISPLAY environment variable for remote display of the local zone onto the X server being executed from the global zone.

To be clear, you have to log in to the global zone in this configuration.  With the default zone configuration, it is not possible to drive your monitor from a local zone.

Using this configuration, I have been able to treat my laptop the same as any other machine on our network.  Coworkers can ssh or ftp to my laptop by fully qualified hostname while I am at work. Their home directories will be automounted. They will feel completely at home.  Also I can run a web server on my laptop, which is tricky to do in a useful way with DHCP.

While we are on the Zones topic, I co-authored a paper on zones targeted at developers recently.  If you are wondering whether your software will work in a zone, check it out.  It has tons of useful information, and good tips that help you sort through the problem of getting your application running in a zone quickly.

Getting Burned

And finally, what desktop is complete without the ability to burn CDs? This is easy enough on Solaris using the cdrw(1) command. Get the volume manager out of the way (vold), insert your writable CD, and point cdrw at your .iso file:
su
pkill -V
cdrw -i myISOFile.iso


cdrw will automatically find your burner (you do have a burner, don't you?) and burn the specified image onto your media.
Don't have a .iso file? You can make one easily using mkisofs(1M).

One of the reasons that the ability to burn your own CD is so interesting to me is because of the very efficient use of space. Imagine that you can put 700MB of data on a very thin wafer of mostly plastic. Using the calculations found in my earlier piece, this slender disk of plastic can store the equivalent of about 76458 2/3 pages of text on a CD! That is about 153 reams of paper! With this technology, you don't have to lug all of that paper around! You can burn it on a disk. You can fling it in a wastepaper basket like flipping a card into a hat. No trees had to be ground to tiny bits to give you the power to do what you will with all of that data.


Technorati Tag:
Technorati Tag:
(2005-06-14 11:14:00.0) Permalink Comments [11]


archives
links
referers