HDMI audio output hell

This is a gigantic PITA. I can’t believe some people still think proprietary software has good support for proprietary hardware – Even with a relatively simple setup like this, many hours of searching forums, installing and reinstalling drivers, fiddling with the BIOS and sound settings still hasn’t produced any sound.

  1. Upgraded the A/V receiver firmware. This was easy since I’ve connected it to the Internet. It’s now got the latest firmware.
  2. Installed, removed and reinstalled the latest video driver – Catalyst Software Suite 12.8. I rebooted after each step.
  3. When I plug in the HDMI cable, a device called Generic PnP Monitor is added to the Devices list. I know it corresponds to the A/V receiver, because it is removed again if I unplug the cable. This messed up the dual-screen display the first time I plugged in the HDMI cable, making only the secondary display active until I managed to move the Catalyst Control Center window from the invisible desktop to the visible one.
  4. Tried to update the driver of the Generic PnP Monitor, but it just says the driver is up to date.
  5. In the Sound → Playback window the AMD HDMI Output playback device is enabled, but it shows simply Not plugged in, so I can’t configure it or set it to the default, as some forum posts instruct.
  6. In the BIOS menu there is a setting called SPDIF OUT Mode Setting [sic], with possible values SPDIF and HDMI. It’s set to SPDIF, according to this cryptic description: Select the [HDMI] option only if you have a video card with HDMI support and are using the SPDIF signal for the high-definition monitor’s speakers. I’m not using monitor speakers.
  7. In the Screen Resolution window there’s a TX-NR509 device. The resolution and orientation can’t be set, and I’ve set Multiple displays to Disconnect this display.
  8. The A/V receiver shows that it’s connected, but not receiving a signal.

In conclusion, both devices know about each other, but Windows 7 seems to think the A/V receiver is a monitor. Any ideas?

HOWTO: Synchronizing vCard address books with Nokia 6300 via Bluetooth on Ubuntu Linux

Edit: After learning a bit of sed magic, this is now a single script.

This Works For Me™, and I hope it works with other phones and on other distributions as well, but no guarantees.

Here’s how:

  1. Download synchronize-bluetooth.sh.
  2. chmod u+x synchronize-bluetooth.sh
  3. sudo apt-get install gnokii
  4. Setup Gnokii (replace the phone name): echo -e "[global]\nmodel = 6510\nport = $(hcitool scan | grep 'phone name' | cut --fields=2)\nconnection = bluetooth" > ~/.gnokiirc
  5. Turn Bluetooth on on the computer and the phone.
  6. Pair the computer and phone. On Ubuntu, simply click the Bluetooth icon and follow the "Set up new device..." wizard.
  • If you want to copy your existing contacts to disk, you can run ./synchronize-bluetooth.sh -r > phone.vcf
  • To copy vCards to the phone, overwriting the existing contacts, run cat *.vcf | ./synchronize-bluetooth.sh -f
  • Note that synchronize-bluetooth.sh works only with the internal phone memory. Address book entries stored in the SIM card, phone log or elsewhere will not be read or written.

    Some features of the script:

    • Works with plain /bin/sh, so it should work on any Linux / BSD distribution.
    • Has separate parameters to read, write and flush contacts.

    synchronize-bluetooth.sh

    #!/bin/sh
    #
    # NAME
    #    synchronize-bluetooth.sh - Synchronize contacts with Bluetooth device.
    #
    # SYNOPSIS
    #    synchronize-bluetooth.sh [options]
    #
    # OPTIONS
    #    -f,--flush       Flush entries on the phone before synchronization
    #    -r,--read        Read phonebook entries (no synchronization)
    #
    # EXAMPLES
    #    ./synchronize-bluetooth.sh -r
    #        Read phone address book entries.
    #
    #    cat *.vcf | ./synchronize-bluetooth.sh -fv
    #        Remove all phone address book entries and write new ones.
    #
    # DESCRIPTION
    #    Warning: Overwrites the existing entries on the phone if you give it any
    #    input.
    #
    #    Some limitations:
    #    - Gnokii (or the phone) doesn't understand N, NICKNAME, ORG and URL
    #      parameters.
    #    - Conflicts have to be resolved manually.
    #    - Getting a "Data format is not valid" error for unknown reasons.
    #    - Needs conv.pl so long as Gnokii / phone doesn't understand the full vCard
    #      spec.
    #
    #    Tested on Nokia 6300 under Ubuntu (7.10-9.10). Instructions:
    #    <https://l0b0.wordpress.com/2008/03/18/howto-copying-vcard-address-books-to-nokia-6300-via-bluetooth-on-ubuntu-linux/>
    #
    # BUGS
    #    1: Not yet tested on other phones or operating systems.
    #    2: No automated comparison of computer and phone entries.
    #    3: Should use safe temporary directory creation - See web pages.
    #    4: Flushing doesn't always get rid of all address book entries.
    #
    #    Email bugs to victor dot engmark at gmail dot com. Please include the
    #    output of running this script.
    #
    # COPYRIGHT AND LICENSE
    #    Copyright (C) 2008-2010 Victor Engmark
    #
    #    This program is free software: you can redistribute it and/or modify
    #    it under the terms of the GNU General Public License as published by
    #    the Free Software Foundation, either version 3 of the License, or
    #    (at your option) any later version.
    #
    #    This program is distributed in the hope that it will be useful,
    #    but WITHOUT ANY WARRANTY; without even the implied warranty of
    #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #    GNU General Public License for more details.
    #
    #    You should have received a copy of the GNU General Public License
    #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    #
    ################################################################################
    
    # Init
    PATH='/usr/bin:/bin'
    ifs_original="$IFS" # Reset when done
    cmdname=$(basename $0)
    directory=$(dirname $0)
    
    # Exit codes from /usr/include/sysexits.h, as recommended by
    # http://www.faqs.org/docs/abs/HTML/exitcodes.html
    EX_USAGE=64
    
    # Output error message with optional error code
    error()
    {
        test -t 1 && {
            tput setf 4
            echo "$1" >&2
            tput setf 7
        } || echo "$1" >&2
        if [ -z "$2" ]
        then
            exit $EX_UNKNOWN
        else
            exit $2
        fi
    }
    
    usage()
    {
        # Print documentation until the first empty line
        while read line
        do
            if [ ! "$line" ]
            then
                exit $EX_USAGE
            fi
            echo "$line"
        done < $0
    }
    
    # Process parameters
    params=$(getopt -o fr -l flush,read --name $cmdname -- "$@")
    if [ $? -ne 0 ]
    then
        usage
    fi
    
    eval set -- "$params"
    
    while true
    do
        case $1 in
            -f|--flush)
                flush=1
                shift
                ;;
            -r|--read)
                read=1
                shift
                ;;
            --) shift
                break
                ;;
            *)
                usage
                ;;
        esac
    done
    
    if [ $read ]
    then
        gnokii --getphonebook ME 1 end --vcard \
            || error 'Failed to get phonebook.'
        exit
    fi
    
    if [ $flush ]
    then
        gnokii --deletephonebook ME 1 end \
            || error 'Could not flush phone entries.'
    fi
    
    sleep 1
    
    # Is there anything on stdin?
    if [ -t 0 ]
    then
        exit
    fi
    
    sed -n '1h;1!H;${;g;s/\r\n //g;p}' <&0 | \
    sed -E s/^ADR\;.*?\(home\|work\).*?:/ADR\;TYPE=\\1:/i\;s/^EMAIL\;.*?\(INTERNET\).*?:/EMAIL\;TYPE=\\1:/i\;s/^TEL\;.*?\(CELL\|FAX\|HOME\|WORK\).*?:/TEL\;TYPE=\\1:/i | \
    gnokii --writephonebook --overwrite --memory-type ME --vcard
    
    err_code=$?
    if [ $err_code -eq 20 ]
    then
        echo 'Data format error, eh? Dunno what to do about that for now.'
    elif [ $err_code -ne 0 ]
    then
        error 'Could not write to phone.' $err_code
    fi

    If you have problems sending the vCards to your phone, you may want to validate them first.

    How to switch keyboard layouts on the Windows XP login screen

    Do you use several keyboard layouts in Windows XP? Ever been annoyed that the layout at the login screen is locked to the installation default? Here’s how to fix it, with a simple registry hack.

    Disclaimer: Use at your own risk, yada yada yada…

    How to enable multiple keyboard layouts at login:

    1. Back up the registry!
    2. Start the registry editor: Press Windows+R, type regedit, and press Enter.
    3. Click on HKEY_USERS, and locate the key (the things which look like directories) which is your SID – It should be one of the longest. If you have problems finding the SID, you can try MS’ own getsid.
    4. Right-click the sub-key Control Panel\Input Method\Hot Keys and select Export.
    5. Save the file to disk.
    6. Open the file in a text editor.
    7. Leave the first line in the file, but remove all the keys (and their name/value pairs) which don’t end in 10X, where X is a number. These are the keyboard shortcuts for switching between the layouts (if you have set any).
    8. Replace the SIDs in the key names with .DEFAULT, so that they will be applied to the default user.
    9. Export the Keyboard Layout\Preload key to a file, and copy the contents (except the first line) into the file you worked with earlier. These are the layout settings.
    10. Now you should have a working registry file. Before proceeding, you should check that it’s at least similar to the one I ended up with, below.
    11. Save and double-click on the file to insert the data in the registry.

    Now you should be able to change the keyboard layout the same way you do it in Windows when logging in.

    Code

    Windows Registry Editor Version 5.00
    ; $Id: dvorak-keyboard-layout-at-login.reg 169 2007-09-25 09:31:02Z vengmark $
    
    ; Shortcut keys for layouts 1, 2, and 3
    [HKEY_USERS\.DEFAULT\Control Panel\Input Method\Hot Keys0000100]
    "Virtual Key"=hex:31,00,00,00
    "Key Modifiers"=hex:05,c0,00,00
    "Target IME"=hex:09,04,02,f0
    
    [HKEY_USERS\.DEFAULT\Control Panel\Input Method\Hot Keys0000101]
    "Virtual Key"=hex:32,00,00,00
    "Key Modifiers"=hex:05,c0,00,00
    "Target IME"=hex:09,04,09,04
    
    [HKEY_USERS\.DEFAULT\Control Panel\Input Method\Hot Keys0000102]
    "Virtual Key"=hex:33,00,00,00
    "Key Modifiers"=hex:05,c0,00,00
    "Target IME"=hex:14,04,14,04
    
    ; Remove old settings
    [-HKEY_USERS\.DEFAULT\Keyboard Layout]
    
    ; Set layouts
    [HKEY_USERS\.DEFAULT\Keyboard Layout\Preload]
    ; US-Dvorak (default)
    "1"="00000409"
    
    ; US-English
    "2"="d0000409"
    
    ; Norwegian
    "3"="00000414"
    
    ; Fallback layouts
    [HKEY_USERS\.DEFAULT\Keyboard Layout\Substitutes]
    "00000409"="00010409"
    "d0000409"="00000409"
    
    ; Use Alt-Shift-# (# is 1, 2, or 3) to change between layouts
    [HKEY_USERS\.DEFAULT\Keyboard Layout\Toggle]
    "Hotkey"="3"
    "Language Hotkey"="3"
    "Layout Hotkey"="3"
    

    How to be (almost) paperless

    The paperless office has become the poster child of a stagnated IT revolution. I won’t say “failed”, because there are ways to get rid of almost all your paper, and gain a lot of efficiency at the same time. It works—Virtually the only time I print is when someone requires a written signature.

    I believe there are two big reasons why people print: Comfort (you’ll be able to read it, bit by bit, anywhere and any time, without eye strain) and safety (it can’t disappear as easily as a file). What follows are paperless solutions for these and other issues.

    Read comfortably

    A good screen is paramount, but how to choose the best? LCD (aka. flat / TFT) screens are generally much more easy on the eyes than CRT screens. To get the proper “paper feeling”, you should get a big screen with a high resolution (don’t worry about the text being too small, that can be adjusted) and high contrast.

    Turn on proper anti-aliasing for a huge improvement in text readability—In Windows, go to Start ? Control Panel ? Display ? Appearance ? Effects, tick Use the following method to smooth edges of screen fonts, and select ClearType. You should also use the free ClearType Tuner to perfect the settings.

    Read anywhere, any time

    For this, the best solution is a laptop or PDA with a good screen. In addition to the attributes already mentioned, you should also make sure the screen has a high maximum brightness—This helps a lot in bright surroundings, such as daylight or a well lit office.

    Take quick notes

    For quick, small notes, you can use A Note. For more organized notes, you can use GTDTiddlyWiki. They are both free, open source, and easy to use.

    Keep control of what to read

    By using an online bookmarking service, you can dispense with paper copies of things you need to read. Here’s what works for me (using del.icio.us):

    • Add the tag “toread” for anything that should be read.
    • Change it to “read” when finished.
    • To indicate that you broke off at chapter 4, just add the tag “at:4”.
    • You might also want to add priorities to the bookmarks, by adding tags like “important” or “pri:1”.
    • Install the Firefox extension – It’s indispensable.

    Add notes / corrections to documents

    It’s easy to annotate paper documents—Just add a scribble in the margin, an arrow here, some underlining there, and so on. But this method has several flaws (in addition to wasting paper): Hand-written notes are often hard to read, they are not part of the document, they can’t be distributed to several persons easily, and they are limited by the space available. Fortunately, modern word processors (like Word and OpenOffice.org) support adding notes and corrections directly in the document. Just take a moment to learn how, and you’ll save a lot of time in the long run.

    Keep document versions separate

    The common method to do this is to have some manually updated version number in the document, and keeping printed versions of the document for each version. This is horribly inefficient, and can be completely avoided.

    First, you can insert a version number which updates automatically. In OpenOffice.org, press CTRL-F2, go to the DocInformation tab, and double-click Revision number. In Word, press CTRL-F9, select the field name RevNum, and press OK. AFAIK, these numbers should increase every time you save the document.

    Second, word processors can show you the difference between two files if you keep them separate, by using a version control system (explained below) or separate file names. In OpenOffice.org, go to Edit ? Compare Document. In Word, go to Tools ? Compare and Merge Documents.

    Third, using a version control system complements the other techniques nicely, while being a great way to handle plain text files and code. By using version control for collaborative documents, you can avoid concurrency issues: You and someone else copy the same document to your hard disk, edit it, and then upload it. If you’re unlucky, all the changes of one of you are overwritten by the other, without warning. Version control systems also keep track of who changed what, and why.

    The previous two points are also handled very nicely—Most version control systems support keyword substitution (like $Version$), and “diff” tools are plentiful and free (I recommend KDiff3 or WinMerge).

    Version control also enables you to keep separate copies of the same files on several machines without having to worry about files becoming obsolete. This is very useful for application settings which are not stored in the registry.

    If you work in IT, there’s probably a CVS or SVN server available. Setting up your own server can be a bit of work, but it’s probably best for your personal documents. In any case, I recommend using TortoiseCVS or TortoiseSVN (both Windows only) to work with the repositories.

    Keyboard wishlist

    As a follow-up to the great keyboard rant by Rob Manuel, here are a few suggestions rants to the keyboard manufacturers.

    Visible logical layout

    The Optimus keyboard should be the hottest thing since … keyboards! There’s no turning back now. Logitech, are you reading this?

    Flexible physical layout

    Don’t like the size/shape of the Enter key? Then change it! Want a Solaris-style shortcut section to the left? Go ahead! Should be easy with projected or touch-screen keyboards, but could be a major pain when adding that springy feeling we’re all so comfortable with.

    Semi-wireless

    Plug it in, and it changes transmission to USB while charging the internal batteries. Works as a dream for the iPod. Oh, I can dream, can’t I?

    Get rid of as many key combinations as possible

    Most people without a university degree don’t seem to catch up on CTRL-C, much less F2, until they’ve used the computer for years. Heck, even the IT consultant who used to have my current job right-clicked for any copy/paste operations! Give Joe / Jane Q Average a keyboard they can understand!

    Oh, and leave us geeks the pipes, tildes and backticks.

    Don’t ever force F lock on boot

    God dammit, Logitech. I will not install your shitty, proprietary software just to turn off that abomination for good! If I turn something off once, I want it to stay that way!

    No multimedia keys

    They make my keyboard clunkier and less user friendly. Especially putting the Sleep button next to Esc.

    Volume dial, not buttons

    The only keyboard I’ve seen with this was my old, trusty Acer. Piece of shit PC, but great keyboard. Just a small whirr, and the sound is full / null. And it just worked.

    Dvorak in rdesktop

    This article is for anyone who is using the Dvorak keyboard layout on Linux, and having problems getting the same to work when connecting to a Windows machine using rdesktop. Jump directly to the solution if you are not interested in the problems encountered.

    Problems

    First, keymaps are just that – AFAIK they just define a translation from the codes sent from the keyboard (“keycodes”, e.g. “41” for the key marked “F” on a QWERTY keyboard) to a symbolic name (“keysym”, e.g. “0x66” with US English and “0x75” with Dvorak keymap when pressing the key marked “F” on a QWERTY keyboard). The problem in connection with rdesktop seems to be that there is a double translation going on when both Windows and Linux are set to use Dvorak – “asdf” on QWERTY should become “aoeu” when using Dvorak, but instead you get “ar.g” in Windows. Argh indeed.

    Second, there is no built in Dvorak support in rdesktop. I googled a bit, but couldn’t find any straight answers for why that is the case. Maybe the “market” is just too small, or everyone else figured out the solution with a lot less trouble than I had.

    Solution

    The only configuration I could get to work is the following:

    • Linux set up to use Dvorak
    • rdesktop set up to use US English ( -k en-us)
    • Windows set up to use US English

    Beware though: Even though you’re using the setup above, your keyboard map will be messed up if the Windows desktop locks, i.e., if you during a session arrive at the login prompt. You should therefore turn off the screen saver, and use the Linux screen lock instead.

    iPod display bug in software version 1.1

    The newest software update for the iPod video has broken part of the playback functionality.

    How to trigger the bug

    1. Use the iPod Updater to install software version 1.1
    2. Start playback of music
    3. Double click the center button (quickly) to go to the rating display
    4. Single click the center button

    Bug nature

    After the last click, you will see the rating display again, instead of the music progress bar. The wheel, however, will work as if you were back to the primary page – It will change the volume.

    The result is that the rating display will “overlay” the other displays, even if the controls work as they would if the correct pages had been displayed.

    To get out of the rating display, just single click the center button until you see the music progress bar again.

    Other information

    Platform: PC with Windows XP
    Updater version: 2006-01-10
    iPod model: 30 GB video (MA146LL/A)