Tuesday, August 11, 2009

Icons for Your system


One annoyance with gaming in Linux is the lack of an icon for a MS Windows run under WINE or Cedega. The Icon Archive is a resource for some game icons as well as icons images for other things.

Mandriva (and other distros) provides the png2ico application, useful if you want to convert a .png image to .ico format for use as favicon.ico for your website.

Mandriva (and other distros) provides the icoutils package which contains two utilities:
icotool will convert and create win32 icon and cursor files.
wrestool will extract icon resources from MS Windows binaries.

The man page for wrestool outlines the process for extracting icons from win32 binaries.

WineIcons "... is a Win32 program for Wine, that allows you to extract icons form ICO, EXE and DLL files and save them in PNG format. It is useful for KDE-like icons creation. WineIcons can be easily integrated into your Linux system."

If you need a free win32 app to extract icon files, @icon sushi is such an application. It runs under WINE as well.

Thursday, July 23, 2009

Fixing a Buggy ACPI BIOS


In the BIOS, there is a table that configures/determines a number of hardware values for ACPI and your system to use.

One of the features of ACPI is that the values and methods used can be differentiated at boot time depending on what OS you run. Each version of MS Windows has a unique identifier and while Linux can identify as "Linux", the Linux ACPI gurus have decided that Linux will always identify itself as "Windows 2001", which is Windows XP. Even if you force Linux to identify itself as Linux, the Linux ACPI code still lies to the BIOS, except for the computers specifically listed in drivers/acpi/blacklist.

If you are running very new hardware intended for Windows Vista, you might get better performance on ACPI-related issues if you identify, or "spoof", your Linux OS as Vista. This is done by adding the boot-time kernel parameter of acpi_os_name="Windows 2006" (and the quotes are necessary).

[I don't know if BSD has similar functionality. Anybody? Bueller? Anybody?]

If you want to know what your particular BIOS will actually allow for
an OS name, follow these directions until you get the disassembled
dsdt.dsl file and look at the section where you find the word
"Microsoft". All the allowed values of the OS name for your BIOS will
be right around there.

NOTE
The default OS definition is "Microsoft Windows NT" and is found in acconfig.h.

From kernel-parameters.txt, "To spoof as Windows 98: ="Microsoft Windows".

From uteval.c, the values given are:
"Windows 2000", /* Windows 2000 */
"Windows 2001", /* Windows XP */
"Windows 2001 SP1", /* Windows XP SP1 */
"Windows 2001 SP2", /* Windows XP SP2 */
"Windows 2001.1", /* Windows Server 2003 */
"Windows 2001.1 SP1", /* Windows Server 2003 SP1 */
"Windows 2006", /* Windows Vista */

Remember, the quotes are needed. And, if the value you are passing is not found in your ACPI BIOS, it will default to the ACPI BIOS default, whatever that is. You need to disassemble your ACPI BIOS as directed above to know for certain.

As a bonus, you might even be able to fix your broken DSDT and it's
easy to add it to your initrd.img.

REFERENCES

Overriding the DSDT
http://powersave.sourceforge.net/powersave/DSDT.html

Linux ACPI FAQ
http://www.lesswatts.org/projects/acpi/faq.php

Linux ACPI Howto
http://web.archive.org/web/20070714030032/http://www.cpqlinux.com/acpi-howto.html

DSDT: Overview
http://acpi.sourceforge.net/dsdt/index.php

Kernel Parameters
http://www.kernel.org/doc/Documentation/kernel-parameters.txt

HOWTO: Fix A Buggy DSDT file
http://forums.linuxmint.com/viewtopic.php?f=42&t=20719

How To Fix Your Buggy DSDT
http://forums.opensuse.org/how-faq-read-only/unreviewed-how-faq/386054-how-fix-your-buggy-dsdt.html

Store(Local0, Local0) generates an error
https://lists.linux-foundation.org/pipermail/bugme-new/2003-November/009350.html

Store(LocalX,LocalX) now produces an error
http://acpica.org/bugzilla/show_bug.cgi?id=785

HOWTO: Fix Common ACPI Problems (DSDT, ECDT, etc.)
http://forums.gentoo.org/viewtopic.php?t=122145

DSDT compilation issues
http://www.mail-archive.com/linux-acpi@vger.kernel.org/msg06782.html

Overriding a DSDT
http://www.lesswatts.org/projects/acpi/overridingDSDT.php

Sensors not updated causing CPU to heat after suspend/hibernate on laptop
https://bugs.launchpad.net/linux/+bug/182929

ACPI Specifications - Toshiba
http://uk.computers.toshiba-europe.com/innovation/download_whitepaper.jsp?service=UK&WHITEPAPER_ID=00000004c6

Friday, June 12, 2009

lsscsi and systool


The lspci and lsusb commands are familiar to me, but lsscsi was unfamiliar. Written by Doug Gilbert, it provides information about SCSI devices by scanning the sysfs pseudo file system. The author maintained a web page (now defunct) that provided useful information about lsscsi, including some detailed descriptions of the SCSI subsystem information available. Fortunately, a copy resides here. Here's a sample listing from my system That also shows the generic SCSI device names (note that command can be run as a regular user) :

$ lsscsi -g
[0:0:0:0] disk ATA ST3250624A 3.AA /dev/sda /dev/sg0
[0:0:1:0] disk ATA Maxtor 6L200P0 BAH4 /dev/sdb /dev/sg1

[1:0:0:0] disk ATA Maxtor 6Y250P0 YAR4 /dev/sdc /dev/sg2

[1:0:1:0] cd/dvd HL-DT-ST DVD-RAM GH22LP20 1.02 /dev/sr0 /dev/sg3
[2:0:0:0] disk Seagate FreeAgent 102D /dev/sdd /dev/sg5
[3:0:0:0] cd/dvd SONY DVD RW DRU-810A 1.0a /dev/sr1 /dev/sg4
[4:0:0:0] disk ST910082 4AS 0000 /dev/sde /dev/sg6


The systool has been around for a while and has a Website. It's a utility developed for the sysfs virtual filesystem used since Linux kernel 2.5. The project's overall goal is to develop diagnostic tools for Linux and the site has several examples.

One use of systool is to reveal what option settings have benn applied to kernel modules . For example, to see information about the libata module (note that it too can be run by a regular user):

$ systool -a -v -m libata
Module = "libata"
Attributes:
initstate = "live"
refcnt = "3"

srcversion = "9BD5A7BE268657853F9CEF1"
version = "3.00"
Parameters:

acpi_gtf_filter = "7"

allow_tpm = "0"

ata_probe_timeout = "0"
atapi_dmadir = "0"

atapi_enabled = "1"

atapi_passthru16 = "1"

dma = "7"

fua = "0"

ignore_hpa = "0"

noacpi = "0"


Sadly, many of these options are not well documented, even in the source code. Even when some comments exist, they are cryptic and could use a decent reference. For example, the allow_tpm option is described with modinfo only to the extent that it can be enabled or disable. There is some discusion of it in the source code, but WTF is it? It appears to be an acronym for Trusted Platform Module, part of software developed by TCG (the Trusted Computing Group). A TPM is a microcontroller on a motherboard used to store keys, passwords and digital certificates, i.e. a hardware-based security device. Why do Linux users care? It seems that a bit in the ATA identify data was re-assigned to TCG and could cause a serious problem for the Linux libata driver since a TGC-enabled drive would trigger 32bit I/O on some systems. Alan Cox submitted a patch to "fix" this by dis-allowing this bit on TCG-enabled drives, causing the system to "opt out" of complying with TCG "security/DRM" features. It does alert the user that they may not have full use of the device. It also was necessary to implement this feature because manufacturers of Linux-run devices may legitimately choose to implement DRM in their devices. Some module options for libata are set from the kernel command line (see kernel-options.txt in the kernel source Documentation). There's also a libATA FAQ which includes info on "Intel combined mode" explaining why your drives are accessed at wrong/different speeds and how to fix that (try combined_mode=libata on the kernel commnd line).

Saturday, June 06, 2009

UNIX Copy-on-Select for MS Windows


One of the most striking differences between UNIX and MS Windows is the copy and paste behavior using the mouse.

This becomes an annoyance if you are used to the UNIX way of doing things and always forget to highlight-right-click-copy when using MS Windows.

Andy Polyakov's True X-Mouse Gizmo allows UNIX-like copy-on-select behavior in MS Windows environments.

The page also contains useful information about how the utility works and how to modify its behavior, as well as a few things to watch out for.

Importantly, it does not remove the traditional MS Windows behavior, so users accustomed to that way of doing things will not notice a difference.

Tuesday, May 26, 2009

IceWm and GMail

I have been using the IceWM window manager and have been exploring how to add functionality and usability to it since it presents as basic window manager. The homepage provides useful documentation and FAQs.

By default, IceWm expects you to have traditional UNIX tools at hand and doesn't automatically provide for newer technologies like GMail. It would be nice for the mail icon to work with a GMail account.

Joel Dare has built upon the work of others and crafted a URL that automatically opens your GMail account in a browser. Importantly, Joel's version of the URL closes any open logins to GMail before attempting to log in; earlier versions of the URL would not complete correctly if you have multiple GMail accounts as I do.

Since the URL contains my password in plain text, I chose to create a script at ~/bin/gmail-login with permissions of 700:

#!/bin/sh
# the following is all on one line
firefox https://www.google.com/accounts/
Logout?continue=https%3a%2f2fwww.google.com%2faccounts
%2fServiceLoginAuth%3fcontinue%3dhttp%3a%2f%2fmail.google.com%2fgmail%26service%3d
mail%26Email%3dUSER%26Passwd%3dPASS%26null%3dSign%2bin

Replace USER and PASS as appropriate.

To use the new script in IceWm, you need to edit the ~/.icewm/preferences file to change the command to point o the script you created in ~/bin. Now, when you click on the Mail icon, your browser will open your GMail account.

BTW: GMail offers a link at the bottom of your main page named "Details". Clicking on that provides you with IP and date/time information about recent access to your mailbox.

KDE's kdict, dict.org and Firefox

I haven't used the KDE desktop since the release of KDE4, instead relying on IceWM. and while I may go back to it, I miss one of the desktop applets, kdict. Using it to check a definition, spelling, synonyms, etc. was very handy.

Since I use Fierfox as my primary browser, it made sense to consider using a bookmarklet. Bookmarklets are small pieces of javascript code that can be treated as a bookmark. When clicking the bookmark, the code will be executed. I modified a bookmarklet for Dictionary.com to use the dict.org dictionary like kdict did.

To make one for yourself, right-click on the Firefox Bookmarks toolbar, then select "New Bookmark", then fill in the following information. The javascript is all on one line.

Name: Dict.org
Location: javascript:void(q=prompt('Dict.org%20Search:',getSelection()));if(q)%20void(location.href='http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query='%20+%20escape(q))

The Database=* value mimics that used by kdict and checks the word with all the available dictionaries at dict.org.

To avoid replacing the current tab, right-click on the bookmarklet to open it in another tab. If someone knows javascript well enough to make it open that way automatically, I'd appreciate it. Ideally, one should just highlight the word and send it to dict.org, but I don't know how to do that yet.

Monday, May 04, 2009

HP Mini 1120NR Mi Edition


My wife surprised me with an HP Mini 1120NR Mi Edition for an anniversary gift!

While it runs Linux, it uses an HP-modified version of Ubuntu, which is a Debian-based Linux. Nothing wrong with that, except that Debian/Ubuntu organizes things differently than Mandriva/RedHat, so it took some getting used to.

The first thing I did was to increase the memory from 1GB of RAM to 2GB of RAM, not that I needed it right now, but RAM is currently very inexpensive. Previous version of Ubuntu for the Mini did not have kernels compiled for >1GB support, but this one recognized it upon re-boot.

The interface is unlike a conventional desktop and is called harbour-launcer. you can see how HP modified the Ubuntu/GNOME desktop by reading how others have modified their desktops to mimic HP.

The first thing that I need to do was install some familiar apps, like mc.

Alt-F2 brings up a RUN dialog, and entering gnome-terminal launches a terminal window. I couldn't become the superuser since I didn't know the password, but HP kindly provides a menu that open a terminal as the superuser, so I did and used passwd to change root's password. HP also provides a menu to launch a software installer, but I just used from the terminal window to update the computer and then to install the Midnight Commander and have a look around the filesystem. HP provides a GUI filesystem browser link in the upper right-hand corner of the screen, but my preference is mc. call me old-fashioned.

The default X configuration sucked, so I changed that to employ all the advanced features of the Intel Mobile GM965/GL960. It's no nVidia graphics card, so the Mini won't be much of a game platform. (config details coming)

My biggest problem was configuring the Mini to use my Verizon UM175 USB modem. The provided Network-Manager app will not allow me to configure it as a serial modem, but insists on telling me that is a GMRS device, even insisting to the point of changing my hand-edited configuration file set to read-only! I am told my knowledgeable Debian gurus that the most recent version of network-manager will work fine, it's just that HP has not released the newer of their variant on Debian/Ubuntu and I'm hesitant to update the non-i386 processor-based Mini from i386 repositories. In the meantime, I installed gnome-ppp and that works just fine, it's just not automatic. WIFI does work fine and network-manager easily configured it.

Oh, gnome-terminal doesn't play well with mc because they both use the F10 key. Fixing this is simple: In the gnome terminal, choose the "edit" menu then choose "keyboard shortcuts"; then tick "Disable menu shortcut key (F10 by default)". No more annoyance.

There is a hidden VFAT partition, sda3, that contains the image files and scripts to restore the drive to "factory fresh" condition from a USB drive. That's great except I've changed so much, but It's worth exploring when I find the time just to see how they did it.

I'll document more of my adventures as I get around to it.

Thanks, Bobbie! 1-4-3