Saturday, April 26, 2008

HVR-950 Todo list

So basically the driver works, and Mauro submitted a Git pull to Linus for the changes. Wohoo. However, there is still work to be done. Here is a list of things I still need to do:

  • IR support - it looks like most of the components are there already (tveeprom support, IR i2c commands, etc). I will need to setup the driver for inclusion in the em28xx driver properly and debug/test.

  • Analog/digital tuner locking - Because the HVR-950 is a hybrid device that supports both analog and digital reception, I need to work out some locking between DVB and V4L to handle cases where one tries to attach while the other is in use. Right now, there is no locking and connecting while the device is in use results in breaking the currently running stream.

  • S-Video/composite testing - I need to test/debug input switching and signal reception for the other ports.

  • Power management - Right now, the device never goes into low power mode from the time you connect it to the USB. Under Windows or Mac, the device is in low power mode until you startup your video application. While this doesn't affect MythTV users, who pretty much always have the backend connected, it would be helpful for more casual users who use it to record audio/video or watch live TV with a standalone application. Besides, the device runs hot already, so it's probably for the best that we power it down when it's not in use.

Aside from the actual device support, I want to get Kaffeine working with ATSC in general. It's annoying there is no standalone application for ATSC reception (Kaffeine supports DVB only). Shouldn't be too hard, but the project doesn't look very active. It would also be nice to have a real test application that does tuning so I don't have to combine mplayer with the command line azap tool.

Centrifugal Force

Friday, April 25, 2008

Debugging fun Solaris Perl crash

Can you spot what's wrong with this picture (truss output of Perl on Solaris)?

/10: llseek(12, 0, SEEK_CUR) = 180224
/10: llseek(12, 0, SEEK_CUR) = 180224
/10: brk(0x0281D3F0) = 0
/10: brk(0x0281F3F0) = 0
/10: read(12, " $ d { " b u s i n e s s".., 8192) = 8192
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: brk(0x0281F3F0) = 0
/10: brk(0x028213F0) = 0
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: brk(0x028213F0) = 0
/10: brk(0x028233F0) = 0
/10: llseek(12, 0, SEEK_CUR) = 188416
/10: brk(0x028233F0) = 0
/10: brk(0x028253F0) = 0
/10: llseek(12, 0, SEEK_CUR) = 185518
/10: brk(0x028253F0) = 0
/10: brk(0x028273F0) = 0
/10: llseek(12, 0, SEEK_CUR) = 185518
/10: llseek(12, 0, SEEK_CUR) = 185518
Here's a hint:

llseek man page
http://docs.sun.com/app/docs/doc/805-8005-03/6j7hcvh5p?l=ru&a=view

Wednesday, April 23, 2008

Putting MythTV's News service to good use

I finally got my MythTV box setup. What better way to take advantage of the customized news than to subscribe to the company's announcement page for "Fruity People" (people who pay 3 dollars a week for Eric to bring in fruit to enjoy during working hours).



This way when I wake up in the morning and turn on the TV, I immediately know whether or not to pick up a muffin on my way into the office!

Sunday, April 20, 2008

Sunday

Victoria came out to New York Friday night. We had a nice lunch, picked up some new sneakers (animal free!), and took a walk through Little Italy. I like Spring...

Got some work done. Trying to get caught up on some stuff that I haven't been able to find a block of time to concentrate on when people aren't interrupting me. Interruptions are part of my job, but it does make it hard to focus sometimes.

Also cleaned up some issues with my HVR-950 driver. Installed the latest MythTV packages for Ubuntu today and did some testing. Works pretty good, but I think there's a locking issue in my driver when going between analog and digital mode. Also, the infrared receiver doesn't work yet, so I can't use my remote control. I started to look at the IR code, but it looks like the device doesn't say it has an IR receiver like other Hauppauge products (there's usually a field in the EEPROM). Will hopefully figure it out over the next few nights this week... There's also some issue with ATSC scanning where the scanning itself works fine but the signal strength and SNR are not reported properly in the MythTV GUI.

I also discovered that apparently Nvidia dropped support for XvMC starting in their GeForce 8xxx series. So with no MPEG2 hardware acceleration during decoding, the CPU is pretty heavily taxed rendering 1080i HDTV which is annoying.

I'm thinking about doing some work on Kaffeine now. It's really surprising that I couldn't find a test application that supports both viewing a stream *and* ATSC tuning. People use Kaffeine with DVB but it doesn't support ATSC, or they use run azap from the command line and then run mplayer to view the stream.

Saturday, April 19, 2008

Fun with routers...

A couple of months ago I spent an evening playing with Transmission (the BitTorrent client for Mac), and I had made a number of changes to my home network in order to get it working. This included updating the firmware in my router, putting my DSL modem into bridging mode, enabling uPNP, disabling the built-in firewall on my Macbook. And the situation got a little better in that uPNP was working, but a couple of days ago I realized I couldn't successfully do an Mercurial update of the source code from www.linuxtv.org without the tool hanging indefinitely in mid download. In fact, I discovered that I couldn't even download the tarball from there without it hanging in Firefox. I confirmed it was not the linuxtv.org website by "borrowing" some wireless from my neighbor, and confirmed it was not any particular workstation since it happened both on my Linux desktop and my Mac laptop.

Tonight, I had had enough, so I sat down and started to troubleshoot the problem. If you don't enjoy fun stores of network troubleshooting, you might as well stop reading.

My basic setup is I have a Westell 6100 DSL modem, which has a built-in NAT and firewall, and I am connected to that with my Belkin F5D7230-4 wireless router, behind which sits my various PCs. I started by looking at the logs in the Belkin router since that is the closest to the PCs. Here's what I found:



Hmmm.... For some reason the router is renewing it's DHCP address very frequently. In fact, it does it exactly every 30 seconds. And why does it think the DHCP lease is only 300 seconds? AND, why does it do a DHCP release followed by a renew, instead of just a DHCP renew? I logged in to the DSL modem and confirmed the internal DHCP server is set to issue leases of 1 day (51000 seconds).

Well, let's start by seeing if there is any new firmware. I updated the firmware two months ago to a release from July, so I guess it's possible that there's new firmware. In fact, release 9.0.10 came out in November, and guess what the release notes say in regards to the fixes:



Yeah, duh. Ok. So I updated the firmware, and while it's not renewing every 30 seconds, it now renews every 46 seconds. I guess we're moving in the right direction at least.



Now I'm starting to wonder about that 300 second lease time, and those of you familiar with the RFC 2131 would know that the "lease time" is actually a worst case before the address is issued to another party, and that client implementations are actually supposed to renew more frequently. Section 4.4.5 recommends a renewal time of (lease * 0.5), but implementations may vary. So, I break out an old 10Mb hub, stick it between the DSL modem and the router, and turn on Wireshark:



Yup, the router really is doing a release/renew, and the server really is issuing a 300 second lease.

From my time doing development on 3Com's routers, I have seen cases where routers that have both DHCP implementations and NAT in some cases will flush out the NAT table entries associated with a given IP if the client does a DHCP release. They do this to ensure that one PC doesn't get the NAT entries associated with a previous PC bound to that IP address. A side effect though is that if it is the same client then all of the state info is missing for sessions in progress.

Also, you might notice that the address issued isn't a private address on the 192.168.2.x network? It looks like a real public network address. In fact, it is. So back to the Westell DSL modem interface. It looks like even though I have DHCP configured for a 1-day lease, this doesn't apply to the DMZ. I had moved the router into the DMZ when I was playing with Transmission because I figured the NAT was flaky and I wanted to just use the modem as a bridge.

Turn off the DMZ, and like magic the lease time jumps back to 51000 and it stops renewing every 46 seconds. Mecurial can download source code. Firefox doesn't hang on downloads. All is well in the world. :-)

So why does the router do a release/renew instead of just a renew, causing the IP to be released and an interruption of service? Well, probably because it's stupid.

Why doesn't the Westell modem follow it's DHCP configuration with addresses in the DMZ like it does with private addresses? Well, probably because it's stupid.

In the end I found a known firmware bug in the router, a protocol violation in the router's DHCP, and what appears to be a configuration bug in the DSL modem's DHCP server. I was really expecting it to be one relatively simple problem.

New lobby furniture

So I came into my building last night and found that apparently we got some new furniture for the lobby.

To give some frame of reference, before we had a small loveseat and two dark covered chairs around a coffee table.

Here's what we have now:

This first picture is what you see when you enter the lobby:

Yes, that's a goose that doubles as a bowl for lemons. How functional! And notice the dog. That's not a real dog, of course, but one made of leather.


Yeah, don't those chairs look comfortable? Notice how low to the floor they are, if you're more than 48" tall, good luck getting up out of one of them.