femtobyte: tech journey

random findings by wt8008
RSS icon Home icon
  • MythTV and XBMC Integration

    Posted on May 28th, 2012 wt8008 No comments

    MythTV’s main purpose is to function as a DVR. XBMC’s purpose is geared towards functioning as a media player—to interface the TV with all media stored on the computer, network, or even the internet. Both are designed with a 10-foot user interface for an HDTV, but XBMC’s interface is more polished. XBMC is cross-platform and is officially available for Linux, Windows, and OSX/ATV.

    XBMC has the basic photo, music, and video viewer just like MythTV, but XBMC’s strength is in its add-on capability. Add-ons extend the functionality of XBMC. Many add-ons reformat website data online and display it directly in XBMC. Examples of add-ons are YouTube, Hulu, Netflix, and podcasts networks. It is also useful for bringing internet-only content to the TV. Official add-ons can be directly downloaded within XBMC. The large XBMC community also provides unofficial add-ons, these add-ons can be found on the XBMC forums. One unofficial add-on is xbmc-addons-chinese, which provides an interface to Chinese websites with flash video and live streaming TV channels. There are also add-ons for other international communities. Some add-ons are platform dependent, if they relay on external supporting applications.

    An official add-on is MythBox which provides can access a MythTV backend. It can replace the main features MythTV’s frontend for watching videos and recordings. Watching live TV is also available, but the interface for changing channels is clunky requiring the on-screen tv guide.

    MythTV Integration

    Currently, I use a combined MythTV frontend/backend setup with Mythwelcome to automatically turn on and off my HTPC for recordings. I am also using LIRC with a remote control.

    A simple way to integrate XBMC into such a setup is to allow the user to launch XBMC directly from the frontend. You can add an XBMC menu entry in MythTV’s menu xml file.

    I am using the media center menu theme, so the corresponding menu xml file is located in /usr/share/mythtv/themes/mediacentermenu/mainmenu.xml

       <button>
          <type>MENU_XBMC</type>
          <text>XBMC</text>
          <description>Launch XBMC</description>
          <action>EXEC /usr/bin/xbmc</action>
       </button>

    The advantage of launching XBMC from the frontend is that MythTV will stop responding to LIRC commands until XBMC exits. The LIRC daemon will send the key action to both programs, if you were to open them separately.

    LIRC Setup

    To map the LIRC remote commands to XBMC actions, you edit ~/.xbmc/userdata/Lircmap.xml:

         <remote device="LIRC_Remote_Name">
            <title>GUIDE</title>
            <playlist>BACK</playlist>
            <menu>MENU</menu>
            <info>INFO</info>
            <back>EXIT</back>
            <up>UP</up>
            <down>DOWN</down>
            <left>LEFT</left>
            <right>RIGHT</right>
            <select>OK</select>
            <myvideo>A</myvideo>
            <mymusic>B</mymusic>
            <mypictures>C</mypictures>
            <mytv>D</mytv>
            <back>BACK</back>
            <pageplus>CHUP</pageplus>
            <pagedown>CHDOWN</pagedown>
            <play>PLAY</play>
            <pause>PAUSE</pause>
            <FastFoward>FASTFOWARD</FastFoward>
            <Rewind>REWIND</Rewind>
            <Stop>Stop</Stop>
            <one>ONE</one>
            <two>TWO</two>
            <three>THREE</three>
            <four>FOUR</four>
            <five>FIVE</five>
            <six>SIX</six>
            <seven>SEVEN</seven>
            <eight>EIGHT</eight>
            <nine>NINE</nine>
            <zero>ZERO</zero>
            <select>ENTER</select>
            <skipnext>PGUP</skipnext>
            <skipprevious>PGDOWN</skipprevious>
        </remote>
    

    Smartphones can also function as a remote control using an app. XBMC system settings need to be modified to enable access.

    Final Words

    With the XBMC add-ons, you do not need to record some network shows, because they are available directly in XBMC over Hulu, although the streaming quality is not as good as free OTA broadcasts. For some shows like news, the lower bitrate is acceptable. There are multiple add-ons with link to different US and international TV networks and sites. With the wide selection of add-ons, XBMC is a great addition to an HTPC.

    There is a PPA available with instructions for Ubuntu users.

  • Samsung Galaxy S 4G Notes

    Posted on January 9th, 2012 wt8008 No comments

    Unlock: The Galaxy S can be sim unlocked as the community found that the unlock code was stored in plain text within a particular file.

    Rooting: giving you root access to the phone.

    • Use SuperOneClick to root the phone: http://shortfuse.org/
    • You will need USB drives. I believe I used the ones which were included with the Samsung Mini Kies software

    ROM flashing

    • Instructions for installing ROM with CWM (clockwork recovery): http://forum.xda-developers.com/showthread.php?t=1215748
    • The procedure flashes a new ROM with CWM installed and using CWM to put on a new ROM.
    • Note: Recovery mode and Download mode are different. Recovery mode (up/down/power buttons pressed). Download mode (up/down buttons pressed while inserting USB cable).
    • CWM allows to install new roms/files from the SDcard while in recovery mode.

    AT&T 3G Support for T-mobile Galaxy S 4G:

    • Phone officially supports T-mobile 1700/2100 MHz UMTS Band IV (AWS), and also over seas Band I (2100)
    • Phone also supports AT&T 1900 MHz UMTS Band II (PCS) from testing with a SIM. Historically, T-mobile uses the 1900 MHz band for only 2G coverage, but has been expanding 3G services on this band. This is the cause of the resent reports of 3G data available on AT&T’s iPhones.
    • AT&T also uses 850 MHz UMTS Band V, not supported on this phone. In some areas AT&T only uses 850 MHz for 3G coverage. On my trip from San Jose to Las Vegas, I found that when there is 3G coverage, almost everywhere also had 1900 MHz coverage. The lower frequency of 850 MHz does penetrate buildings better, which can make a difference in some areas.
  • Porting AT&T Landline Phone to Google Voice

    Posted on October 4th, 2011 wt8008 2 comments

    In my previous post, I explained how I purchased a Obi110 for use with Google Voice. I am porting my landline phone to Google Voice for use with my Obi110 and some features. I have to first port the landline to an intermediate cell phone provider (T-mobile), since Google Voice only supports porting in from cell phone providers. (See the link in the reference section for detailed instructions.)

    Currently, the AT&T landline bill is about $28 after all fees and taxes. The landline itself is about $20 and the remaining $8 consists of taxes and fees.

    Timeline

    This is the timeline of events for porting.

    • Thurs 09/22/2011 08:28 PM – Order Placed for prepaid SIM for $7.57
    • Fri 9/23/2011 – Shipped
    • 9/24 – 9/25 Weekend
    • Tue 9/27/2011 Afternoon – Arrived
    • Weds 9/28/2011 Afternoon – T-mobile Prepaid Online Activation, did not take long, does ask for a cell phone IMEI. I’m sure it doesn’t matter what you put in there.
    • Weds 9/28/2011 12:45pm – Call T-mobile Porting Department at 1-877-789-3106, right after activating. The call took about 8 minutes and I received a reference number to the porting request. It was stated that it could require 3 to 10 business days to port, but it may be faster.
    • Thurs 9/29/2011 06:45 PM – T-mobile asked to call them regarding the port. The porting department did not have my prepaid number on file and needed to know it so they can replace my cell number. My landline number was also released by AT&T to allow for the porting to begin. T-mobile activated and said that calls will slowly go to T-mobile over the course of 2 to 24 hours. For a period of time calls went to either the landline or the cellphone.
    • Fri 9/30/2011 8:30 AM – Begin port to Google Voice. The prepaid account number is the landline number with area code. Also dial tone for the landline was lost.
    • Fri 9/30/2011 12:38 PM – Email from Google regarding incorrect PIN. Resubmitted Prepaid PIN.
    • Sat 10/1/2011 8:30 AM – Email from Google notifying port completion.
    • Sat 10/1/2011 10:00 AM – Tested phone service to verify functionality.
    • Verify with AT&T that the landline has been canceled.

    It required two days to finish the port from the evening of 9/29, all day on 9/30, until the morning of 10/1. I did not try to receive calls on the prepaid phone during the port to Google Voice. Callers were directly placed into T-mobile voice mail. Make sure to check the voice mail box before the port is complete. Press * to interrupt the greeting and then the last four digits of the landline number as the voice mail pin.

    Costs

    It will require 2.5 months to break even assuming free calls, which is currently true, see the summary table below.

    Obihai 110 $42.99
    T-mobile Prepaid $7.57
    Google Voice Port $20
    Total $70.56
    Time for ROI 2.5 months

    It is unknown if free calls will remain beyond 2011.

    References

  • Experience with Obihai Obi110 and Google Voice

    Posted on September 22nd, 2011 wt8008 No comments

    Edit: Google will be shutting down XMPP for Google Voice in May 2014, rendering the Obihai box less useful. I will need to find a new system before then.

    I brought an Obihai Obi110 not too long ago. By connecting a normal PSTN phone to the FXS port and to the internet to the ethernet port, the Obi110 allows for VOIP on your old landline phone. The Obi110 supports up to two standard SIP providers or Google Voice. The Obi110 also has a FXO port so you can also connect your current landline to it. You can receive calls from any of the two VOIP providers or your current landline. (See block diagram.)

    Currently I setup the device to dial out over Google Voice. The second SIP provider is Onesuite used for international dialing purposes. For receiving calls, I am currently using my old landline number. Later, I will port this into a VOIP provider or to Google Voice (via T-mobile). I am going to wait and see what Google Voice does with Google Chat initiated calls, if it remains free or the per minute charges. Call out via Google Voice and receiving calls via the landline works as expected with excellent voice quality. Proper QoS settings may be needed to reduce jitter. (UDP destination port 5060 for SIP and TCP destination port 5222 for Google Talk.)

    E911

    Another issue is E911, I believe most setup with a separate VOIP provider which has this feature. For serious setups, a UPS power backup is also needed. Besides the broadband mode, router, the Obi110 itself, any wireless phones also need backup power.

    Features

    Some features which I now can have access to are caller id, voicemail indicator, and 3-way calling/call forwarding. Google Voice providers free caller id (number only), which is an expensive feature with my landline provider. With new voicemails on Google Voice, the Obi110 can signal the phone to light up the voice mail indicator. Google Voice with the Obi110 allows for 3-way calling and call forwarding from the phone by flashing the phone and dialing the destination number. Any of these features are costly extras if I used them with my landline service.

    Obihai also provides a nice web based site to setup, configure the device and status monitoring. Perhaps, you can use this to configure, setup, and maintain remote clients for family. You can setup speed dials for frequently used contacts.

    The Obi Attendant allows you to call your Obihai device and make phone calls from it by matching caller id. An application is to allow us to access our international VOIP provider via our cell phones.

    Others also setup an Asterisk PBX to do a more elaborate setup or dialing plan, but it is not necessary for me.

    Goal

    With AT&T raising landline rates and fees (disguised as taxes), it would be great to cut off the $20/mo landline bill. Although there will be some short-term hardware costs and number porting fees, it will require 3 to 6 months to become net positive.

  • VPS Trim Down Memory Usage

    Posted on August 8th, 2011 wt8008 No comments

    This post is meant to be a list of todo items when setting up a VPS with low memory. It is not designed to be accurate or complete, just some notes and observations.

    • lighttpd – web server replacement for apache, configure home directory sites and additional domains.
    • mysql – disable innodb, which is the cause of most of the memory usage, and use conservative configurations to save memory. Newer versions of mysql do not have bdb option, so it is not necessary to disable it.
    • dropbear – ssh server to replace openssh, add as start up service. Each ssh connection spawns a new process, so the memory savings adds up.
    • php – limit to 1 process and a small handful of threads. I use 1 process and 4 children.
    • bind9 – disable this process, it is not necessary
    • postfix – install a smaller mail server
  • List of RSS Feeds on my Google Reader

    Posted on July 19th, 2011 wt8008 No comments

    Edit: As of 7/2/2013 Google Reader has been shutdown. I have migrated to Feedly for now.

    What is on your Google Reader? I have way too many subscriptions on my Google Reader and cannot rigorously read each item. Google Reader is web-based RSS feed aggregation, for those who have not heard of RSS, you are missing out. If you subscribe to a particular website feeds, then when the site pushes out a new update, it will show up as a new item in Google Reader. Now, if you like to visit many sites for to read new articles, you can visit Google Reader in place of visiting each site individually. It is a time saver and waster.

    I originally used Google Reader to put in blogs and sites that I rarely visit, since there were a large number of sites that I was semi-interested in that did not require a daily visit. Now it is my main source for reading blog and news posts, since it is convenient to only visit Google Reader. Here are some of the sites that I currently subscribe to.

    Electronics/Technology/Industry:

    • IEEE Spectrum Online – IEEE members should already know about this, bringing news related to the broad discipline of electrical engineering.
    • Electronic Design – industry news, magazine
    • EE Times – industry news, magazine
    • Electronics Blog – showcases links to other places of people’s DIY projects or to introduce new parts
    • SparkFun Electronics – DIY/hobbyist electronics site for parts, started up a few years ago from University of Colorado students. I follow the feed on the home page for new product announcements and user’s projects.
    • bunnie’s blog – the monthly Name that Ware series is always a brain teaser, where a cropped out photo is shown for readers to guess what it is from

    Technology/Linux:

    • Slashdot – “News for Nerds. Stuff that Matters”, I don’t need to explain this one. With a broad audience, sometimes news from here is overlapped from the other sites.
    • Omg! Ubuntu! – Ubuntu Linux related posts, usually orientated towards users for customization
    • Terminally Incoherent – random posts about movies, games, IT stories
    • Rickipedia – slow to update, more information on industry used Linux distros

    Comics:

    • xkcd – A webcomic of romance, sarcasm, math, and language. A must read, if you can figure the comic out (hint: see the xkcd forums).

    Financial:

    • The Finance Buff – the blog authors various observations and investigations to items involving money and finance
    • Money:GTL – no update in half a year, not sure if the author is going to keep up with the postings

    Others:

    • mustangdaily.net – Cal Poly student newspaper
    • Cal Coast News – local news for California Central Coast communities
    • Serious Eats – food based blog with many interesting topics beyond just recipes such as food policy, news, and laboratory experiments
    • Incorrect Basketball Knowledge – Podcasts on sports that I mean to listen to one day, but not have yet

    These links are directly to the sites, you will have to dig around and look for the orange RSS icon for each site to get the feed URL.

    I do have a few more, but the list is getting too long. The amount of effort it put in to read each one varies due to the volume of new posts everyday.

  • FTDI USB-Serial Converter for New Products

    Posted on April 14th, 2011 wt8008 No comments

    If you have a generic FTDI product that simulates a serial port (COM port), but it does not register as /dev/ttyUSB0 in Ubuntu/Linux, it could be that the device is too new or a rare product (industrial use) and not a recognized vendor/product ID. (This also applies for products that use a USB-Serial bridge for communications.) You can attempt to tell if the product uses such a chip by taking a look at the ICs on the product itself or by the drivers it uses in Windows.

    Use lsusb to see what new shows when you plugin the USB device.

    Bus 002 Device 002: ID 413c:a005 Dell Computer Corp. Internal 2.0 Hub

    In this example the vendor ID is 413c and the product ID is a005.

    You can manually allow it to register by:

    sudo modprobe ftdi_sio
    sudo su -c "echo 413c a005 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id"

    using the vendor and product IDs from the previous step. It should show up as /dev/ttyUSB0 unless you already have another device plugged in. You can see the output of dmesg to determine the exact name/device file.

    You may need to give yourself permissions to read and write to the device.

    sudo chmod +rw /dev/ttyUSB0

    Auto Register when Connected

    For automatically preforming the commands upon connection create a file /usr/local/bin/serial-usb.sh with contents

    #!/bin/bash
    modprobe ftdi_sio
    echo 413c a005 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

    Give the file executable permissions with

    sudo chmod +x /usr/local/bin/serial-usb.sh

    Create a new udev rule to detect when the device is plugged in to run the previous script with a file in /etc/udev/rules.d/70-serial-usb.rules with the contents:

    ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a005", RUN+="/usr/local/bin/serial-usb.sh"

    You may need to restart/reload udev by

    sudo /etc/init.d/udev restart
  • MythTV with SPDIF Digital Sound Output and Passthrough

    Posted on March 24th, 2011 wt8008 No comments

    Most modern motherboards will include a S/PDIF header, but with a soldering iron, one is easily added. This allows for digital audio output from the onboard sound. The next part shows how to configure and test a setup using ALSA tools and mplayer for Linux. Finally, a custom asoundrc configuration is used for MythTV to allow for analog and digital output for stereo streams and digital passthrough for DTS and Dolby Digital encoded audio.

    S/PDIF Connector

    My MythTV system uses the ECS K8T890-A motherboard, it does not contain a S/PDIF header. Upon closer inspection, near the PCI-e slot, you will find that ECS used a Realtek ALC655 for audio output. The datasheet for the ALC655 is publicly available. From the specifications, the ALC655 supports digital output, but ECS did not include headers for it. With a soldering iron, this is a non-issue. The reference design gives a simple circuit consisting of a few capacitors and resistors to allow the ALC655’s output to be interfaced with a S/PDIF compatible receiver. S/PDIF connectors used are typically RCA or BNC. The decision will be based upon what cables and connectors you have available. Cables with characteristics impedance of 75 Ω should be used for best performance. This value is typically used for video coax. Once you have a RCA or BNC pannel/borad mount connector, you need to secure it to the PC chasis. If you have old, unused PCI cards, you can remove their brackets for use. As an example, with a unused Ethernet card, the hole for the Ethernet jack can allow you to glue in a RCA socket.

    From the `Pin Assignments’ section in the datasheet, pin 48 is named SPDIFO. In the `Pin Description’ section it describes the function as “S/PDIF output” which is what is needed. The dot indicates Pin 1 (see the photo below modified from Japanese Wikipedia.) Pin 48 is on the edge of the device and is not a pin in the center, making it easier to perform soldering. (Warranty likely does not allow for user modifications. ;-)) Solder a thin wire such as 30 AWG to the pin. Make sure the wire is long enough to reach the PC case. Tug on the wire to verify the solder joint; the wire should not break off. Next the wire needs to be secured, as the solder joint cannot handle stress. Glue the wire about 1 inch away from the ALC655 to the motherboard edge; hot glue will work for this application.

    Realtek_alc655_pins

    Next, secure with hot glue the RCA socket to the Ethernet back plate. Solder on the circuit from the design guide directly on the back of the RCA socket pins. Finally, solder the glued wire to the input of the circuit. Remember the solder a ground connection, the ground connection is the metal of the back plate itself. Now, connect a 75 Ω cable between the computer and the device.

    Linux Setup

    Now to properly configure the digital output and test it using mplayer.

    In alsamixer(1) verify that IEC958 output is not muted. Use the hotkey `M’ to unmute it. The value should read “MM” when muted, and “00” when enabled. Now lets review what devices are available on the system with:

    aplay -l

    the output is

    [email protected]:~$ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: V8237 [VIA 8237], device 0: VIA 8237 [VIA 8237]
      Subdevices: 4/4
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
    card 0: V8237 [VIA 8237], device 1: VIA 8237 [VIA 8237]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    With only one sound card, they should be all listed as card 0. Also, note that I have 4 subdevices. Some users will see an analog and digital device here. (I do not so the configuration file in the next section differs.) Next, view the ALSA names for the sound devices on your system with

    aplay -L

    the output is

    [email protected]:~$ aplay -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    pulse
        Playback/recording through the PulseAudio sound server
    front:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        Front speakers
    surround40:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        4.0 Surround output to Front and Rear speakers
    surround41:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    iec958:CARD=V8237,DEV=0
        VIA 8237, VIA 8237
        IEC958 (S/PDIF) Digital Audio Output

    You should see a iec958 or spdif device here.

    Use mplayer(1) to output via S/PDIF by manually selecting it on the command line with:

    mplayer -vo none -ao alsa:device=iec958 filename

    where -vo is no video out device, -ao alsa:device=iec958 is the audio out device by using the alsa audio driver, and device name is from the ones given in aplay -L. The sound should only output from the digital port. You can test files with encoded DTS audio or Dolby Digital audio by using

    mplayer -vo none -ao alsa:device=iec958 -ac hwdts,hwac3 filename

    This allows for directly passing the encoded audio signal to your receiver, the software will do no decoding. You should be able to get bit perfect surround sound.

    MythTV Audio Settings

    To always use digital output, go to
    Utilities/Setup -> General -> Audio page
    and use the following settings:

     Audio output device:         ALSA:iec958
     Digital Audio Capabilities
         Dolby Digital            check
         DTS                      check

    Digital Output

    Note the name of the device `iec958′ matches the output of aplay -L and mplayer.

    On the next page,

     Use internal volume controls      uncheck

    Internal Mixer Setting

    If this is not unchecked, then the system will decode and re-encode the DTS/Dolby Digital audio as PCM.

    The system is then setup to always output a digital signal.

    MythTV Setup for Dual, Analog and Digital, Outputs

    If the audio source was not DTS or Dolby Digital encoded, then you can output both to the digital and analog outputs with a custom .asoundrc configuration by creating a virtual device that maps the left and right audio channels. If the audio source was DTS or Dolby Digital encoded, only the digital output is available. (MythTV only can output one audio stream.)

    A custom .asoundrc is needed.

    # ~/.asoundrc or /etc/asound.conf
    # ALSA configuration file
    
    ##### USAGE #####
    # Save this file as "~/.asoundrc" (for user-specific sound configuration) or
    # "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
    # device names ad described in the next section.
    
    ##### IMPORTANT #####
    # To make this ALSA configuration file work with your sound card, you will need
    # to define the appropriate card and device information for the "analog-hw" and
    # "digital-hw" devices below.  You can find the card and device information
    # using "aplay -l".
    
    # Default output device
    pcm.!default {
      type plug
      slave {
        pcm dualout
      }
    }
    
    ##### Configuration File #####
    
    # Override the default output used by ALSA.  If you do not override the
    # default, your default device is identical to the (unmixed) "analog" device
    # shown below.  If you prefer mixed and/or digital output, uncomment the
    # appropriate four lines below (only one slave.pcm line).
    #
    # Alias for device names
    
    # Actual device name usable for applications
    pcm.dualout {
        type plug
        slave.pcm "dual"
        hint {
            show on
            description "Output to analog and digital ports"
        }
    }
    
    ctl.dualout {
        type hw
        card 0
    }
    
    # The following devices are not useful by themselves.  They require specific
    # rates, channels, and formats.  Therefore, you probably do not want to use
    # them directly.  Instead use of of the devices defined above.
    
    # Alias for analog output on the card
    # Do not use this directly--it requires specific rate, channels, and format
    pcm.analog-hw {
      type hw
      card 0     # MODIFY to match your setup
     # The default value for device is 0, so no need to specify
    #  - Uncomment one of the below or create a new "device N" line as appropriate
    #    for your sound card
    #  device 1
    #  device 4
    }
    
    # Control device (mixer, etc.) for the card
    ctl.analog-hw {
      type hw
      card 0
    }
    
    # Alias for digital (S/PDIF) output on the card
    # Do not use this directly--it requires specific rate, channels, and format
    pcm.digital-hw {
      type hw
      card 0
      device 0    # MODIFY to match your setup
      subdevice 3 # MODIFY to match your setup
                  #  Remove this if not needed (many won't need this line)
    #  - Comment out "device 1" above and uncomment one of the below or create a
    #    new "device N" line as appropriate for your sound card
    #  device 2
    #  device 4
    }
    
    # Control device (mixer, etc.) for the card
    ctl.digital-hw {
      type hw
      card 0
    }
    
    # multi -- a virtual device with four channels. This maps two stero streams
    # from the analog and digital outputs as one 4-channel stream. (Complex format)
    pcm.multi {
      type multi
      slaves.a.pcm "analog-hw"
      slaves.a.channels 2
      slaves.b.pcm "digital-hw"
      slaves.b.channels 2
    
      bindings.0.slave a
      bindings.0.channel 0
      bindings.1.slave a
      bindings.1.channel 1
      bindings.2.slave b
      bindings.2.channel 0
      bindings.3.slave b
      bindings.3.channel 1
    }
    
    ctl.multi {
      type hw
      card 0
    }
    
    # dual -- creates a 4 channel pcm stream based on the multi device. Maps this
    # devices 4 streams to the multi device. (Interleaved format, supported by most
    # applications)
    pcm.dual {
        type route
        slave.pcm "multi"
        slave.channels 4
        ttable.0.0 1
        ttable.1.1 1
        ttable.0.2 1
        ttable.1.3 1
    }
    
    ctl.dual {
        type hw
        card 0
    }

    This defines a name for the analog and digital output device. Next, it creates a virtual 4 channel device and maps the analog and digital audio channels to it. Finally, an interleaved format device is created for MythTV’s usage.

    The pcm.analog-hw block defines the exact card and device of your analog output. Typically this is card 0 and device 0. Verify the card and device indices with mplayer(1):

    mplayer -ao alsa:device=hw0.0 filename

    The expected output is sound from your speakers connected to the analog outputs. Similarly, for the pcm.digital-hw block, find the exact card and device (and possibly subdevice) with

    mplayer -ao alsa:device=hw0.0.3 filename

    My IEC958 device is located on card: 0, device 0, subdevice 3. Use the process of elimination to determine the exact index of the device. Modify the corresponding section of the configuration file with the card, device, and subdevice index.

    The other pcm.multi, pcm.dualout, and pcm.dual do not need to be modified as they only preform channel mapping. In MythTV, configure the default output device to be ALSA:dualout. (`Scan for audio devices’ feature only detects “type plug”.)

    Analog Digital Output

    Stereo analog and stereo sound should output for 2 channel audio sources. For audio encoded in DTS or Dolby Digital, your receive should receive the raw data and preform the decoding.

    References

  • KDE4 Ambience Theme in Ubuntu for KDE Applications

    Posted on November 21st, 2010 wt8008 No comments

    I have been running Ubuntu 10.04 and wanted to configure the appearance of KDE applications to match the Ambience theme in Ubuntu. Luckily, there are some built-in themes which helps with the configuration.

    First use the KDE 4 System Settings Center to change the Appearance of the KDE widgets, colors, icons, and fonts. The system settings center is located in the systemsettings-kde4 package. (If not already installed.) Run

    $ systemsettings

    to start up the configuration program. Select “Appearance” (or “Application Appearance”) to change KDE applications widget style, colors, icons, and fonts.

    1. Style
    2. Choose the “GTK+” widget style from the drop down menu. This will match the style of the progress bars, buttons, slider bars, drop down menus, etc. to the Gnome style.

    3. Colors
    4. The metallic color scheme of KDE4 can be changed here. You can import the file that I modified from KDE-look. (See References for original creator.) The colors roughly match, but may not exactly match.

    5. Icons
    6. Select “Ubuntu-Mono-Dark” icon theme to match the Ubuntu standard icons.

    7. Fonts
    8. Change the font settings here to match the font settings that were chosen in Ubuntu. If the font size number does not match the KDE application font size, you may need to use the “Force fonts DPI” option. You can see your current font settings in System->Preference->Appearance and the fonts tab.

    With these settings your KDE4 applications should fit in nicely with the Gnome based desktop!

    References:
    Ambiance-like: KDE Color Scheme KDE4

  • Dockstar Running Debian

    Posted on November 13th, 2010 wt8008 No comments

    The Dockstar is a plug computer runs a Marvell 1.2GHz ARM processor with 128 MB RAM and 256 MB flash which stores it’s own variant of Linux. The boot loader on the device can be modified to boot off a USB stick, leaving the original Linux on the flash unmodified. Using Jeff’s guide it was possible to put Debian on a USB stick and boot from it easily.

    Before starting, since the device will phone-home, the hbwb process needs to be killed before connecting to the internet. Using the guide from ahsoftware.de, the process was disabled. The dockstar can be connected to an offline router with a DHCP server so that you can get its IP address. Otherwise without a DHCP server, it will asign itself an IP address of 169.254.x.y, where x, y are the last two bytes of the device’s MAC address. With the IP address, ssh into the device as root with the default password of stxadmin. The next step is to kill the hbwb process, remount / as writable, chmod go+w /dev/null, and modify the rcS init.d script to prevent hbmgr.sh from running. Remount / as read-only, and the device can then be restarted/halt.

    Next follow the instructions on Jeff’s site to partition a flash drive using fdisk(8). Then download and run his script to install Debian on the flash drive. After it is completed, if the Dockstar does not boot into Debian, reboot the device by using a pen/paper clip by pressing the reset button on the dockstar for a warm boot. Some flash drives such as Kingston’s have issues with cold booting.

    Cold Boot

    If you setup netconsole, you can see the boot messages from the dockstar and see where the cold boot fails with the usb drive. The first run of “usb start” causes the issue, so Mike on the fourms changed the uBoot options to re-start the USB every time the dockstar boots, essentially making every boot a warm boot to the USB thumb drive. Use fw_setenv to modify the variables.

    Applications

    Now with the armel version of Debian installed, the dockstar can run almost anything Debian can. (Ubuntu does not have armel repositories.) The exception is of course is the hardware. Speed of the flash drive can be come an issue, especially when writing many small files. There is no video output, but there is a serial console if you want to so some soldering. The current application for my dockstar is for running CUPS as a print server. Future applications I have in mind is a NAS type server. For now, I am using it to store my tomato CIFS bandwidth logs. It can also be a useful SSH server. Any applications which require 24/7 uptime can use the device, as it is also low power compared with a normal computer system. More applications and usages will come as I think of some as they are needed.

    References

    http://ahsoftware.de/dockstar/
    http://jeff.doozan.com/debian/