# femtobyte: tech journey

random findings by wt8008
• ## HDHomerun, Comcast QAM, MythTV

Posted on September 4th, 2010

With my new HDHomeRun, I need to setup MythTV backend to get channels from Comcast unencrypted QAM.Mythbuntu comes preinstalled with the hdhomerun_config command line and GUI tools, under Applications->Multimedia->HDHomeRun Config GUI. If it is plugged in the “Scan” button will discover any tuners on the network. Also, if you plug different sources into HDHomeRun, such as Cable and OTA, note the tuner numbers for later reference. If you have dual tuners you will have two entries. From there, you can flip through the channels and view what streams exist under that channel. With the “View” button VLC will open and play the video stream.

HDHomeRun Config GUI

The device ID of your HDHomeRun can be found by

$hdhomerun_config discover The output will look like hdhomerun device XXXXXXXX found at Y.Y.Y.Y where the XXXXXXXX represents the HDHomeRun ID, and Y.Y.Y.Y is the IP address. You should note the ID for use later on. ### Channel Scanning Integrating into Mythtv is not as direct as I hoped. The scanner built into Mythtv 0.23 does not handle the Comcast QAM stream properly. It can scan the channels, but it cannot use the virtual channel numbers from Comcast, and Mythtv will results in many conflicting channel numbers. Follow the guide at http://www.mythtv.org/wiki/Scte65scan to use scte65scan to scan and discover the virtual channel numbers. The rough procedure from the wiki is below: 1. Run mythtv-setup to configure the backend. 2. Setup section 1: General, and section 2: Video sources. Do not setup the other sections (or else the database dump of scte65scan will not work, maybe using -f4 as a command line option is a workaround and also default sourceid=1 , not tested or tried yet.) 3. Download scte65scan source and HDHomerun libraries, follow the instructions to compile and for editing the HDHomrun Makefile. 4. The VCT_ID for my area is 3065 (0x0bf9), after following the instructions on the wiki to discover them (the scan takes a few minutes): $ ./scte65scan -H FFFFFFFF us-Cable-Standard-center-frequencies-QAM256

5. Now the SQL script will be generated to be used to import into Mythtv.

$./scte65scan -H XXXXXXXX,0 -p -f3 -V 3065 us-Cable-Standard-center-frequencies-QAM256 > vct.sql Recall XXXXXXXX is the HDHomeRun ID, the 0 after it represents the tuner number, -p option is needed for the local PSIP channels in the cable stream, -f3 for SQL install script, -V 3065 where 3065 is my local areas VCT_ID, us-Cable-Standard…. is a file containing the channel frequencies that will be scanned, and finally vct.sql is the output SQL script. Read $ scte65scan --help

for more details.

6. Next import the output to the SQL database

$mysql -u mythtv -p mythconverg < vct.sql This allows you to access the mythconverg database as the mythtv user, but remember to lookup the database password in the Mythtv frontend before you proceed. The other method is to logon as -u root, if you remember the initial password you setup for it. If you get an error regarding ERROR 1062 (2300) at line 4: Duplicate entry '1' for key 'PRIMARY' it is due already having video sources defined, you can either delete them, or try different -f options in $ scte65scan --help

7. The channel information entered is viewable in the backend setup under 5. Channel Editor. Continue with the setup by adding the 3. Video Source, and the channels should populate without a scan. Also setup the 4. Input connections.

The channel scanner for OTA signals works fine, so you can use the internal scanner for that purpose.

### Inferred Sensor

Using the inferred sensor on the HDHomeRun requires telling the device to forwards the signals to the backend, using lircd on the backend to process the signals into keys, and having mythtv map the remote key presses to keyboard shortcuts.

The HDHomeRun site has a guide for setting up the HDHomeRun.

$hdhomerun_config <device id> set /ir/target "<backend-ip>:5000 store" The store command saves the setting into flash, so on reboot of the tuner, it will continue to foward the IR commands. Next, use irrecord to let the computer learn each key of the remote. $ irrecord -H udp -d 5000 "<name of remote>"

Attempt to give generic/general key names, since later a parser will be used to generate the key maps to Mythtv. Copy the resulting file,

# sudo mv "<name of remote>" /etc/lirc/lircd.conf

Now to start up lircd the first time, I recommend using verbose mode to watch what happens.

# sudo lircd -n -H udp -d 5000

Use irw to test the setup. With irw running press remotes on the key and it will print out the corresponding key that is pressed. If all is well then configure the /etc/lirc/hardware.conf file. Some recommended settings

REMOTE_DRIVER="udp"
REMOTE_LIRCD_CONFIG=/etc/lirc/hardware.conf"

Now, setup the key mapping between lirc and MythTV, Mythbuntu users can use

$mythbuntu-lirc-generator This will parse the keynames in /etc/lirc/lircd.conf and guess a corresponding key/function in MythTV. Next, manually edit the generated file $ vim ~/.lirc/mythtv

Custom mappings or unmaps keys needs to be manually added in. The format is

begin
remote = "<name of remote>"
prog = mythtv
button = CHUP
config = Page Up
delay = 0
repeat = 0
end
• ## LaTeX and Posters

Posted on May 14th, 2010

I needed to produce a poster for my project and of course I could not stay away from LaTeX for this job. A package I chose to use was sciposter, it has some standard poster sizes built in (no help for us in the USA), and typically it is used with the multicol environment. The rest works just like normal LaTeX, except you document is now limited to a column. Some other classes allows more flexible placement and uses many minipages to layout the poster.

A quick template for sciposter

\documentclass[custom,landscipe]{sciposter}
\pagestyle{empty}
\usepackage{multicol}

% Page size commands for dvips, pspdf converters
% Tri-fold poster board size
\special{papersize=48in,36in}
% Prevent dvips making document upside down
\special{! TeXDict begin /landplus90{true}store end}

\title{Sciposter Template}
\author{wt8008}

\begin{document}
\maketitle
\begin{multicols*}{4}
% Content Here
\end{multicols*}
\end{document}

The custom option to the class allows you to define your own custom paper size in a file papercustom.cfg’ here is mines

% file papercustom.cfg, M.H.F. Wilkinson
% custom paper support
% for sciposter.cls v1.10 and higher
% edit pointsize, width, height, and fontsize parameters as needed
% DO ensure that values in the \special commands match!
\renewcommand{\papertype}{custom}
\renewcommand{\fontpointsize}{25pt}
\setlength{\paperwidth}{36in}
\setlength{\paperheight}{48in}
\renewcommand{\setpspagesize}{
\ifthenelse{\equal{\orientation}{portrait}}{
\special{papersize=36in,48in}
}{\special{papersize=48in,36in}
}
}

Of course everything is explained in the documentation, so take a look at that for more detail at CTAN.

For printing the poster, use poster(1)

sudo aptitude install poster

It will take in a postscript file and split the file up with overlapping areas to help you put the pages back together. Make sure you read and understand the poster assembly instructions in the man page for the proper way of putting it together. Suggested usage:

poster -v -p48x36i infile.ps > outfile.ps
• ## LG Incite

Posted on October 31st, 2009

In August, my family got some new cell phones, the LG Incite and Samsung Eternity. As you can see it is currently November, so this is old news.

The phone only comes in silver, and it is a touchscreen based phone. The touchscreen itself is average, but should be more responsive. When comparing with the Eternity, it is obvious that the Incite is not as responsive, and both phones use a resistive touchscreen. There is no D-pad on the phone, so the touchscreen is the main way to navigate through the interface, although there is a small scroll wheel on the side. Other buttons include a camera button and lock button, but the buttons can be customized to open other programs or perform other actions. The phone also includes a 3.5mm standard headphone jack, useful for listening to phone calls or music, without any special plugs. Before, I didn’t like having my iPod and cell phone together in my pocket, but since I always carry my combined mp3 with me, I listen to Podcasts daily. (More TWiT listeners ;)) Of course, the iPod interface is not comparable with my phone, but I don’t find it worth the extra effort to carry it for a few minutes of music/podcast appreciation on the short walk to class. The camera is 3 megapixels, but from CNet sample photos, the camera on the Eternity results in pictures with better brightness, especially in low light situations. There is also a stylus, but there is no proper place for it on the phone. The stylus just ties onto the phone, and hangs off of it. I feel that the stylus gets in the way when it is hanging there, so I didn’t put mines on. The phone includes internal A-GPS that works well with the Google Maps, especially on satellite view! I disabled the “A” part of A-GPS, because assisted GPS uses the cellular towards to give an initial position, while the GPS hunts and locks to the satellites. This method works by having the towards send data to your phone, about 7KB each time. Data? That is a no-go for me, since it is $2/MB, so 7KB rounds up to$2.

I was able to get the phone for free without a dataplan. The price and the lack of dataplan requirement was the reason why I purchased this phone. There are registry hacks to disable MediaNET, as smartphones can use lots of data by itself, by auto-connecting to the Internet and check email or update weather conditions. The ability to disable built-in data, including auto-connecting to 3G/EDGE was also an important consideration before I got the phone.

From the factory the phone runs Windows Mobile 6.1, which is not finger friendly at all, once you move away from LG’s interface into Windows Mobile land, the tiny buttons and scroll bars are very difficult to work with, and impossible if you were on-the-go. The leaked Windows Mobile 6.5 versions out there are way better, they definitively do not require a stylus. With WinMo 6.1, it would be handy to have one around, but with 6.5, you can toss it out. The phone has limited memory, so multitasking can slow down the phone a lot. (Although, I can also consider myself lucky for being able to multitask.) From time to time, I need to verify sure programs are actually exited, and not still running in the background, as lack of memory is not good, especially for running Internet browsers. Sometimes, I will get out of memory errors, when opening new programs, and if there are memory leaks, then a reboot is in order.

Google Sync for Windows Mobile via Google’s exchange server is also a convenient feature that syncs my contacts, email, and calendar onto my phone. Activesync automatically keeps my phone up to date via WiFi. Calendar with alarm reminds sometimes can come in handy. Syncing contacts allows for backing up, and handling only one address book. It can also support push email, but nzane2k noted that it was slow to push. When I move around WiFi hotspots, I sometimes need to manually restart the syncing process.

I have tried to take a few photos, but I didn’t really try hard at all.

LG Incite box and free Bluetooth headset

Where is the phone

Comes with a USB cable, Samsung users don't get one!

• ## To Grandma

Posted on October 31st, 2009

May you rest peacefully.

October 29, 2009

• ## Tomato CIFS Bandwidth Logs Backup

Posted on August 4th, 2009

As seen from my previous post, I have moved to Tomato firmware for my router. A feature that caught my eye was the ability to save bandwidth logs to CIFS (Samba shares). My ISP does not have any monthly bandwidth limitations, but I know some others in my area does, and this feature would be a must have for them. By default the bandwidth history is saved in RAM, and if the power goes out, then all the logs will be lost.

On my Linux server, I created a new user (adduser(1)) with a default shell of /bin/false (/etc/passwd), and also a corresponding samba user (smbpasswd(1)). I configured the Samba share for that user with

[tomato]
path = /home/tomato
public = no
writeable = yes
also, the server's global setting requires a security level of user
[global]
...
security = user

On the router in Administration->CIFS Client, enable cifs1, for the UNC enter in the IP address, and share name. Do not use the hostname of the system.

\\192.168.1.5\shared_example

also enter in the username and password of the samba account that was created above. Hit save to mount the share, and after the 10 second countdown, you’ll see the total size of the mount, and the free space left.

Now to enable the remote log saving. In Administration->Bandwidth Monitoring, change the save location to CIFS. I used the Create New File for the first time running it, but I am not sure if that option is necessary. Hit Save, and go to your share and see the backup log. The monthly start date can also be adjusted, for those who need to monitor monthly usage based upon an arbitrary day.

• ## Tomato Firmware Hostname

Posted on July 29th, 2009

I always wanted to access my router via its hostname instead of typing the router IP in. This works fine in Linux, but for some reason Windows resolves hostnames different. I checked in windows with nslookup, and it can resolve my router name, but in Firefox or IE it doesn’t work. I had the same problem when using dd-wrt.

In the Basic->Identification section, I randomly added a domain name of home, and now windows can resolve the router hostname and router.home, also points to my router. For past routers I used, I typically leave this field empty, as the documentation says it is provided by my ISP. This solution doesn’t require massive editing of config files on the router or editing host files.

The computers can resolve themselves just fine either via the router DNS, Samba, or Avahi. I am not sure which one is doing the work.

• ## Chinese Characters in Flash

Posted on July 17th, 2009

With flash, Chinese (font) characters show up as boxes instead of the character itself. To remedy the issue

 $sudo rm /etc/fonts/conf.d/69-language-selector-zh-cn.conf I don’t like the shipped configuration default for Ubuntu CN anymore. Don’t worry this is only removing a symbolic link. Create a new file /etc/fonts/conf.d/63-wqy-zenhei.conf and populate it with <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias> <family>sans-serif</family> <prefer> <family>WenQuanYi Zen Hei</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>WenQuanYi Zen Hei</family> </prefer> </alias> </fontconfig> This files adds the WenQuanYi Zen Hei font to the sans-serif and monospace font families. Next, in the 30-cjk-aliases.conf file accept the WenQuanYi Zen Hei font as acceptable mappings to Windows fonts such as SimSum and MingLiu. Make sure that the font is first, as the system will pick the font by ordering. A sample snippet of affected areas <!-- Aliases for Simplified Chinese Windows fonts --> <alias> <family>SimSun</family> <family>NSimSun</family> <family>SimSun-18030</family> <family>NSimSun-18030</family> <family>å®‹ä½“</family> <family>AR MingtiM GB</family> <accept><family>WenQuanYi Zen Hei</family></accept> <accept><family>AR PL UMing CN</family></accept> <accept><family>AR PL ShanHeiSun Uni</family></accept> </alias> <!-- Aliases for Traditional Chinese Windows fonts --> <alias> <family>MingLiU</family> <family>ç´°æ˜Žé«”</family> <family>PMingLiU</family> <family>æ–°ç´°æ˜Žé«”</family> <family>AR MingtiM BIG-5</family> <accept><family>WenQuanYi Zen Hei</family></accept> <accept><family>AR PL UMing TW</family></accept> <accept><family>AR PL ShanHeiSun Uni</family></accept> </alias> <alias> <family>æ¨™æ¥·é«”</family> <accept><family>WenQuanYi Zen Hei</family></accept> <accept><family>AR PL UKai TW</family></accept> <accept><family>AR PL ZenKai Uni</family></accept> </alias> <!-- Alias for HKSCS --> <alias> <family>Ming (for ISO10646)</family> <accept><family>WenQuanYi Zen Hei</family></accept> <accept><family>AR PL UMing HK</family></accept> <accept><family>AR PL ShanHeiSun Uni</family></accept> </alias> Now, Chinese charaters in font work correctly without editing 49-sansserif.conf to map unknown fonts to sans instead of sans-serif. The solution which others have suggested created an issue with the font of a buddy on pidgin. • ## cups-pdf Printer Margins Issue Posted on May 4th, 2009 I needed a way to print to pdf from a wine application. Typically the Gnome printing system has a pdf printer that I can use. I run micro-cap, a spice program for homework and prelab work for my analog filters course. I installed the cups-pdf package in the repositories, and it seemed to work great. After I sent the pdf to the printer, I found out that cups-pdf prints all the way to the edge. When I print the results out, the edge gets cut off by my printer. To remedy this issue, I went to see the PPD file for the printer in /etc/cups/ppd/<pdf-printer name>.ppd . The line that reads *ImageableArea Letter/US Letter: "0 0 612 792" sets the allowable printable area. I changed that line to *ImageableArea Letter/US Letter: "18 12 594 780" the numbers were from my laser printers ppd file. If you use A4 sized paper, change the corresponding line, and proper values for A4 paper. • ## Gears Theme Posted on April 6th, 2009 Today I upgraded to the latest wordpress and also decided to update my blog’s theme. I am currently using the Gears theme. I like it so far, I may play around with it if I have some time or need to modify it. Currently I just modified the text color for posts to black, before it used a sliver/gray color, which is something that I do not like. In the style.css file modify the color field to #000000 for black text. Also in sidebar.php, I added <li class="login"><?php wp_register();> • ## Mythtv Remote udev Rules Posted on March 22nd, 2009 I was looking at setting some udev rules for my remote for mythtv, so that if I change the input devices (i.e. add or remove a mouse/keyboard), I want the name of the device to be constant so that I do not need to modify my lirc configuration files. I tried to setup this before, when I first setup mythtv (see my earlier mythtv post), but I never got it to work. There were two issues, one is that the filename for the rules was wrong, and also I had issues with the rules themselves. Anyways here is how you do it… This is my complete /etc/udev/rules.d/10-localremote.rules file KERNEL=="event*",ATTRS{name}=="saa7134 IR (Avermedia AVerTV GO",SYMLINK="input/irremote" This will link /dev/input/irremote to the device that is associated with my tv tuner’s IR receiver. [email protected]:/dev/input$ ls -l irremote
lrwxrwxrwx 1 root root 6 2009-03-22 15:06 irremote -> event3`

Right now, it points to event3, but if I plug in my mouse and keyboard irremote will then point to event5.

The associated file /etc/lirc/hardware.conf should also have the REMOTE_DEVICE field point to the new device.

There is some way to setup the remote using hal, but I will give that a try another day. See http://www.doctort.org/adam/general/update-on-twinhan-remote-for-mythbuntu-810.html I will give that a try another day.