Tuesday, July 18, 2017

My Hauppauge 350 stopped working!

At some point recently, my Hauppage card stopped working. I know eventually this card is going to stop working... Thats life, either a bit rot, a blown cap or damage from a power surge will kill this fun little card.

I don't give easily though. Gnomeradio complained it couldn't open '/dev/radio0' and it was right, the device was not present. Time to check the logs....

ivtv: Start initialization, version 1.4.3
ivtv0: Initializing card 0
ivtv0: Autodetected Hauppauge card (cx23415 based)
ivtv0: Unreasonably low latency timer, setting to 64 (was 32)
AVX version of gcm_enc/dec engaged.
AES CTR mode by8 optimization enabled
tveeprom 5-0050: Encountered bad packet header [ff]. Corrupt or not a Hauppauge eeprom.
ivtv0: Unknown model -16636, defaulting to PVR-150
ivtv0: Autodetected Hauppauge WinTV PVR-150
ivtv0: tveeprom cannot autodetect tuner!
ivtv0: No tuner detected, default to NTSC-M

Very odd. I have a PVR-350, not a 150.    I figured there must be some thing I could do by passing the right parameters to the module at load time. MythTV's wiki has a good write up of the module parameters.

Checking the output from 'lspci' I id my card as this device:

04:06.0 Multimedia video controller: Internext Compression Inc iTVC15 (CX23415) Video Decoder (rev 01)

Add this line to /etc/modules since I am lead to believe I might have rev 01 card...

ivtv cardtype=5 radio=1
The next bit of magic is too put the changes in the initramfs image the kernel loads at boot:

sudo update-initramfs -u

Next, reboot and I found that the ivtv module seemed to find that tuner card again.

ivtv: Start initialization, version 1.4.3
ivtv0: Initializing card 0
ivtv0: Autodetected Hauppauge card (cx23415 based)
ivtv0: Unreasonably low latency timer, setting to 64 (was 32)
tveeprom 5-0050: Hauppauge model 48132, rev J323, serial# 7113504
tveeprom 5-0050: tuner model is Philips FM1236 (idx 23, type 2)
tveeprom 5-0050: TV standards NTSC(M) (eeprom 0x08)
tveeprom 5-0050: audio processor is MSP4448 (idx 27)
tveeprom 5-0050: decoder processor is SAA7115 (idx 19)
tveeprom 5-0050: has radio, has IR receiver, has no IR transmitter
ivtv0: Autodetected Hauppauge WinTV PVR-350


So I started up Gnomeradio, and it eventually segfaulted on me.  And it still had no audio.  I see the following the kernel logs before that happened. 

i2c i2c-5: sendbytes: NAK bailout.
tuner-simple 5-0061: i2c i/o error: rc == -5 (should be 4

According to the documentation for the ivtv module, there is other revision of the PVR-350, I have nothing to lose by giving it a shot... I changed the parameters to the ivtv module, and repeated my earlier steps of rebuilding the initramfs and rebooting.

This time, it seems to OK at first:

ivtv: Start initialization, version 1.4.3
ivtv0: Initializing card 0
ivtv0: Autodetected Hauppauge card (cx23415 based)
ivtv0: Unreasonably low latency timer, setting to 64 (was 32)
AVX version of gcm_enc/dec engaged.
AES CTR mode by8 optimization enabled
tveeprom 5-0050: Hauppauge model 48132, rev J323, serial# 7113504
tveeprom 5-0050: tuner model is Philips FM1236 (idx 23, type 2)
tveeprom 5-0050: TV standards NTSC(M) (eeprom 0x08)
tveeprom 5-0050: audio processor is MSP4448 (idx 27)
tveeprom 5-0050: decoder processor is SAA7115 (idx 19)
tveeprom 5-0050: has radio, has IR receiver, has no IR transmitter
ivtv0: Autodetected Hauppauge WinTV PVR-350
saa7115 5-0021: saa7115 found @ 0x42 (ivtv i2c driver #0)
saa7127 5-0044: saa7127 found @ 0x88 (ivtv i2c driver #0)
msp3400 5-0040: MSP4448G-A2 found @ 0x80 (ivtv i2c driver #0)
msp3400 5-0040: msp3400 supports radio, mode is autodetect and autoselect


Success!

And this time gnomeradio works!   

Saturday, April 1, 2017

I'm going to build a truck camper!

I've always wanted to get back into RVing and I've been slowly introducing my  wife to camping since I've met her.

I personally grew up RVing with my parents and once I was on my own, I picked up tenting.

I still love tenting and I do plan on getting a new ultra light tent in the coming months. However, I really wanted a substantial, no fuss solution.  I don't think my problem is unique, I want to make the most of my weekends during our very short hunting seasons here in New Brunswick.  Deer season is short and with vacation time is always at a premium - the appeal of setting a tent at an undisclosed remote location at 10PM on a Friday night in a Canadian fall is minimal.

Tents are too much work in those conditions. I really dont like setting up camp in the dark.. And it might be a very wet and cold weekend.

A small trailer is out - I'm going aiming for 'dispersed camping' (I love Crown Land!). I don't want to deal with having to turn a trailer of any size on old logging  roads. Couple that the the possibility of my preplanned spot being inaccessible or already taken is a real possibility. So in short, a trailer is out. It does work for some people, but its not what I see my self doing.

If I had an 8 ft box or maybe even a 6.5ft, I'd do a 'simple' truck cap mod. Not having that...

My solution is simple : I'm building a truck camper.

There is so many pro's: protection from the elements and wildlife. Minimal setup. Easy navigation. Enough room for guests with out having to get too friendly...

Cons... Cost. Build time. 

Buying a camper is pretty much out of the question - its out of my budget for the next few years and the 5.5ft models are rare.

I will have some challenges. My F150 is a short box... 5.5ft short.   And I want it before the next hunting season.  And I want to keep it affordable.

Luckily, I have some Glen-L plans to reference and my father has tons of advice for this build having done it in the 80's.  Fortunately for him, he lives too far away to help me physically build it every weekend.

I have some interesting requirements for this build:
* affordable
* fits in a 5.5 ft box
* boondocking / dry camping focused
* possible remote office
* upgradable...

The main point my father stressed is that I have to plan out everything before I build it.  I don't have to have the equipment installed, I just need to have a plan on how I'm going to cleanly install that item/system later on.  My father's reason for this is both practical and hard learned. Its easier to design a cut out or wire run before the camper is built.

I have a few ideas for the build that each deserve their own separate posts. Radios, solar, heating issues have all been topics that have been on my mind lately. If you have any ideas, I'd love here about them. 

Monday, January 23, 2017

Install gnomeradio in Ubuntu 16.04

In a previous post, I got my old Haupagge 350 PCI card tuning in local radio stations.  I'm pretty comfortable with comandline programs to get things done but I wanted to find at least one GUI program that actually just worked.

gnomeradio

The best option I could find isn't even packaged for Ubuntu 16.04 any more so I installed the Ubuntu 14.04 package instead.



   It sounds wrong to do this, but it does work.

wget https://launchpad.net/ubuntu/+source/gnomeradio/1.8-2ubuntu32/+build/7325329/+files/gnomeradio_1.8-2ubuntu32_amd64.deb
sudo dpkg -i gnomeradio_1.8-2ubuntu32_amd64.deb

Monday, January 16, 2017

Hauppage 350 FM Radio in Linux

I'm not sure why, but lately I've been getting interested in radios.  I was digging through my desk the other day and I stumbled on my old Hauppauge PVR 350 Tuner PCI Card.  

If you're still using Ubuntu 14.04, you'll have to manually load the ivtv drivers to use the card.

However, it turns out that Ubuntu 16.04 recognizes the card and installs the drivers automatically. You only have to install a few programs to control the tuner after that.

ivtv-utils

'ivtv-radio' has to be my favorite tool I've found so far to listen to the radio.  It simply works will little overhead if you know the stations you should be able to receive.

$ sudo apt-get install ivtv-utils 

$ ivtv-radio -f 99.5set to freq 99.50Running: aplay -f dat < /dev/video24Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Simply CTRL-C the program and rerun it with the frequency you want to switch too.

fmtools

This package deserves an honorable mention. It gives you some simple control over the tuner and no direct playback.  It is useful if you want to scan the bands for a station or simply control the tuner and record the station to a file.

Install fmtools:
$ sudo apt-get install fmtools

To scan:
$ fmscan -d /dev/radio0
I found that fmscan missed every station on the band that still came in clear enough in my opinion. The fact is I'm using a simple dipole antenna in the basement of my house might be the problem but I also noticed something in the man page:
If your card's hardware cannot report signal strength, it will not produce useful results.
It might be that the Hauppauge 350 can not report signal strength.


Tune to a station:
$ fm -d /dev/radio0 89.9 65535



References:

Wednesday, January 4, 2017

Copying Files off a Harddrive from a Western Digital NAS


Buddy (names withheld to protect the stupid) came to me with a drive  saying he couldn't get his data off it.   Buckle up folks, this story got convoluted fast, and took me forever to get out of him.  I'll skip the step of turning that into a narrative and save you the trouble of having to read that by giving you the Reader's Digest version.

It all started with his son rage quitting on his laptop and destroying the motherboard in the process.  Turns out that the hard drive took a good hit too and was toast. Buddy had to take the drive to a professional data recovery firm to get his data off the drive.

I suspect that they required him to supply a new hard drive to dump the recovered files on to.  This where it gets interesting technically.  He pulled it out of some sort of Western Digital NAS.  It had a bizarre layout for a single drive NAS:


Layout of the drive from the WD NAS

Who puts a RAID array set on the same drive?  Alas, that was not the weirdest thing.  I knew that the data partition must have been /dev/sde4 as it was the largest.  When I tried to mount /dev/sde4, 'mount' errorred out and the following showed up in my syslog:

[ 1080.819587] EXT4-fs (sde4): bad block size 65536

Turns out that sde4 is actually an EXT3 or EXT4 filesystem with a 64k block size instead of the usual 4K block size.  A bit of googling later I learned that the Linux kernel when running on an x86 platform, can not do a 64k block size.

FUSE to the rescue!


Luckily, there is a work around.  Seems that other owners of the WD NAS's pull the drives out of the NAS for what ever reason and get stuck with this problem.  So with /dev/sde4 being the WD NAS drive and /dev/sdg1 being the new Windows friendly drive here's what was done:

sudo mkdir /mnt/sdg1
sudo mkdir /mnt/sde4
sudo mount /dev/sdg1 /mnt/sdg1
sudo apt install fuseext2
sudo fuseext2 -o ro -o sync_read /dev/sde4 /mnt/sde4
sudo rsync -ahv  --no-perms --no-owner --no-group /mnt/sde4/shares /mnt/sdg1/
I'm going to leave out the commands I used to prepare /dev/sdg which was a new 'WD My Passport'.  I figured it was best to reformat the drive  both so it would be easier to move files on to a VFAT filesystem rather then an NTFS filesystem and there is the odd story about viruses and other junk that is preinstalled on some consumer drives.

Unmounting the drives


Before ripping the Passport drive from the USB port, it's very important to unmount the filesystem. Simply run this:

sync
umount /dev/sdg1
umount /dev/sde4

Problems I encountered


The rsync command did take a while and I did run into some problems with the process just stalling a few times.  'iotop' would show no disk IO and there was no indication anywhere about something had gone wrong.  I'm not sure why that happened but once I added the '--no-' options to the rsync it worked fine.  Perhaps it was luck, perhaps there was something fundamental about that.

Conclusion


While is was a tiny bit of challenge,  it was pretty straight forward to pull the data off the WD NAS drive.   If you find yourself in a similar situation, I hope this helps out.