Wednesday, October 29, 2008

Halloween shopping and MacBook audio on Intrepid

I went shopping for my and Victoria's halloween costume after work. There was a line about a block long to get into the costume shop. Took me an hour to get in and out of there. The price I pay for waiting until the last minute I guess...

Jury duty tomorrow. Fun fun. I have to be there at 8:45. Ugh.

I installed the latest Ubuntu Intrepid updates in the hopes that it would fix my MacBook audio (all I was getting before was static). After it didn't help at all, I played around with the mixer settings and discovered that the PCM output was set to 0%. I turned it up and all of a sudden I had sound again. Yay.

Kaffeine is getting annoying. There is some bug where if the ATSC signal level falls too low even for a couple of seconds, the audio stops working entirely until you change channels (the audio doesn't come back even after the signal quality reaches an acceptable level again). If I'm actually going to try to use Kaffeine for television watching, I'm going to have to do several fixes
  • Add code to disable the screen saver in fullscreen playback mode
  • Figure out why the audio keeps cutting out
  • Get the HVR-950 remote control working
  • Look at the vertical sync problem that seems to occur with my monitor (it's probably some issue with XVideo playback and the Nvidia binary driver)

Talked to the guys from Pinnacle this morning. They're sending me hardware for the Ultimate 808e device, and going to work on getting me access to the datasheets. Yay.

Tuesday, October 28, 2008

Pinnacle 80e: Fully Functional

I'm watching The Tonight Show using the Pinnacle 80e under Linux.

It's all downhill from here: cleanup code, work out licensing with Micronas, and prepare patches for submission upstream.

Not bad for a piece of hardware that showed up on my door on October 10th. A little less than three weeks to get to a fully operational state, and that included working out getting access to the datasheets and reference driver source with the chipset vendors.

Pinnacle 80e lock - FINALLY!

With mkrufky's help, I finally got the Pinnacle 80e to lock. Successfully did a channel scan and it looks like it's finding all the usual suspects.

Now I just need to get the transport stream working from the drx3933j to the em2874, and I'll be watching TV on this sucker.

Man, that was annoying...

Monday, October 27, 2008

Avid Technology Announces Sale of PCTV Product Line to Hauppauge Digital

So the business unit that makes Pinnacle tuners has been sold to Hauppauge:
http://www.avid.com/company/releases/2008/081027_pctv_pinnacle.html

This can only really be a good thing for Linux. The developers at Hauppauge write a large portion of the tuner drivers in Linux (independent of who uses them). And combined with Pinnacle's recent support of my Linux development, this is great news.

Still struggling to get that first lock on the Pinnacle 80e. Very frustrating.

I did debug some issues yesterday with Kaffeine QAM scanning support for digital cable. Fixed a crash, and made a couple of other improvements. Found out how screwed up Time Warner's PSIP information is. Ugh.

Tuesday, October 21, 2008

Black Tiger

Every morning I make myself a cup of coffee from the coffee machine. The flavor I choose is called "Black Tiger".

And every morning I wonder if out of nowhere David Carradine is going to pop out and show me a new Kung fu move.

Pinnacle 801e remote control support

Didn't get any work done on the Pinnacle 80e last night because I had my CoOp's board meeting, and I had to debug why the dib0700 IR support stopped working with firmware 1.20.

Submitted a proposed patch last night, although I'm not sure it's completely correct. On the plus side, I had never gotten around to testing the remote control for the Pinnacle 801e, so at least with the fix I now know that it works.

Also, it looks like my s5h1411 fixes got merged into the mainline:

9314: http://linuxtv.org/hg/v4l-dvb/rev/1e74817c525e
9315: http://linuxtv.org/hg/v4l-dvb/rev/2d6bf8c8bcd5
9316: http://linuxtv.org/hg/v4l-dvb/rev/b44a3aede3d1

Yay for faster tuning!

Sunday, October 19, 2008

Continued Pinnacle 80e progress

Pinnacle 80e status from this afternoon:
  • Successfully loaded the drx3933j firmware over i2c
  • Successfully controlled the i2c gate to the tda18271 tuner
  • Fully initialized the tuner
  • Implemented lock status and SNR routine in demod frontend
  • Issued tuning command (which isn't yet getting lock yet)
I'm now at the point where all the moving parts are in place - I just have to debug why I'm not getting signal lock.

Also, I finally nailed that s5h1411 timing bug with tuning lock, so now I'm consistently getting 300ms lock on the Pinnacle 801e. It turns up Mkrufky was having the same issue with another product, and my fix made it go from "horrible" to "now it works".

Submitted two final patches for the fix, as well as a patch to properly power down the s5h1411 when not in use. This is in addition to the 9 patches already pending against xc5000.

Also took a couple of minutes to submit two Kaffeine4 patches that I had pending in my queue for a couple of weeks.

Oh yeah, and did I mention that I am engaged?

Saturday, October 18, 2008

Engaged

Last night I asked my beautiful girlfriend to marry me, she said "yes", and now we are engaged.

Yay!

Wednesday, October 15, 2008

Pinnacle 80e progress

Made progress bootstrapping the Pinnacle 80e tonight:
  • Fixed bug in em28xx EEPROM read routines
  • Successfully read the EEPROM contents
  • Added support for GPIO setting under em2874
  • Turned on the LED and brought drx3933 out of reset
  • Initialized i2c clock to 400MHz
  • Successfully detected drx3933 on the i2c bus

Read alot of documentation tonight. Working up a plan for how to tackle the demodulator driver. The existing em28xx driver will need some changes but is 90% there. The existing NXP 18271 driver should work unmodified. The big issue is there is no drx3933j driver at all, so I have to implement one from scratch, using the datsheets and reference driver source (which I can look at but not copy).

Tuesday, October 14, 2008

Pinnacle rocks!

So I've decided: Pinnacle is awesome.

Doug Lung introduced me to the Senior Product Manager for the Pinnacle PCTV product line. After extending them an invitation to improve the Linux support for their products (I already added support for the Pinnacle 800e and 801e without them), they did the following:
  • Sent me a free hardware sample of the new Pinnacle PCTV HD Mini (80e)
  • Assigned an engineer to answer my technical questions (which has already saved me hours that would have been spent reverse engineering)
  • Introduced me to the CEO of Empia, who has provided me with full datasheets for the em2874 for the express purpose of writing a GPL'd Linux driver.
  • Connected me with a contact at Micronas, who provided me with the full drx3933j datasheets and the source code to their reference driver. They even emphasized the need to Micronas for the firmware to be freely redistributable so it can be bundled with the Linux distros.
Complete datasheets including the register maps, reference driver code, freely redistributable microcode, not having to personally shell out the cash to buy the tuner. I really don't think there is more that I could have asked for.

Monday, October 13, 2008

Pinnacle 801e users: please update to trunk

To all those who are using my Pinnacle 801e patch from August 27th, please stop using this patch. All of the changes have been merged into the mainline, including the fix for the thermal bug that is not in the Aug 27th patch.

Just do the following:

hg clone http://linuxtv.org/hg/v4l-dvb
cd v4l-dvb
make
make install
Comments still welcome, of course (either below in the comments section or via email). Just please make sure you're running the latest code before you submit problems.

Thanks.

Friday, October 10, 2008

Pinnacle 801e tuning versus HVR-950

I've been working on my tuning problem every night this week. Frustrated and confused, I decided to approach this from a different perspective. I figured I would get a baseline using my HVR-950 so I could assess how consistent tuning is in my area for various stations. I obviously considered the possibility that the HVR-950 would have problems too, but if it behaved consistently then it would be a good basis for comparison.

I started with looking at tuning speed in general. Here's what I came up with for the HVR-950 using the current v4l-dvb trunk (note, I pruned out duplicate subchannels from this list).

Channel / time to lock (ms)
2-1 / 352
5-1 / 322
7-1 / 320
9-1 / 334
11-1 / 313
25-1 / 321
31-1 / 310
41-1 / 313
68-1 / 318

I got consistent lock against all channels inside of 350ms.

Now compare this against the unmodified v4l-dvb trunk for the Pinnacle 801e:

Channel / time to lock (ms)
2-1 / 3190
5-1 / 3194
7-1 / 3194
9-1 / 3189
11-1 / 3189
25-1 / 3189
31-1 / 3194
41-1 / 3190
68-1 / 3190

So it is consistently locking, but almost an order of magnitude slower.

I tried to do the same test for the Pinnacle 801e with my changes, and found that the tuning time was to unpredictable to accurately measure. I was times seeing in the areas of 350ms, 500ms, 1500ms, 2500ms, 3500ms, and tuning failure for even a single channel (the cap is
5000ms for Kaffeine so it's possible that we would have achieved tuning lock after that).

Then I started looking at w_scan performance:

HVR-950 - 27 stations found, time: 3:58
Pinnacle 801e (first run) - 16 stations found, time 9:05
Pinnacle 801e (second run) - 18 stations found, time 9:02
Pinnacle 801e with my changes (first run) - 13 stations found, time 3:09
Pinnacle 801e with my changes (second run) - 25 stations found, time 3:12
Pinnacle 801e with my changes (third run) - 26 stations found, time 3:09

The HVR-950 consistently finds all 27 stations in four minutes. The Pinnacle driver is all over the map regardless of my changes. My changes make the w_scan timing more consistent with the HVR-950, but it does not appear to have an affect on the quality of the tuning results.

In summary, I see four possibilities:
1. My Pinnacle hardware is defective
2. There is something wrong with the xc5000 driver
3. There is something wrong with the s5h1411 driver
4. There is something wrong with my intergration of the xc5000/x5h1411 for the Pinnacle 801e.

Anyway I look at it, this is pretty frustrating.

Tuesday, October 7, 2008

More work on Pinnacle 801e tuning speed

Since I got all the changes pushed for the Pinnacle 801e, over the weekend I went back and started looking at the various xc5000 cleanup work I had pending.

Learned to use quilt on Saturday afternoon (thanks mkrufky!). Prepared a series of patches breaking down the individual changes. Submitted for comments.

Sunday night, discovered that there is some sort of timing bug where I only get successful lock around 50% of the time with my changes. Crap. I don't think it's my changes, but the changes exacerbate the issue.

Spent the last couple of nights debugging the issue. I still don't have it nailed down, but I did figure out that because of DVB-T inversion support, failed tuning attempts get repeated even though you can't adjust the inversion. With that fix, a run of w_scan went from 9:20 down to 6:11. Nice. Combined with my other xc5000 fixes, it brought the time down to 3:11. That's basically three times faster.

Will continue to debug tonight. I'm *so* close. I just need to figure out the timing and I can push in half a dozen patches and move on to other stuff.

Update:Yeah, I just hit the submit button and realized I had pretty much already described much of this in the previous post. Doh.

Sunday, October 5, 2008

Weekend

Today, Victoria, Jen, Jon, and Jayden went to the Bronx zoo. It was alot of fun, but what a PITA it was to get there (subway work on both the 2 and 5 lines). Will post the pictures the same time I get the D.C. photos up from last week.

Submitted a cleaned up batch of xc5000 fixes to Mkrufky. These changes aren't essential, but clean up the i2c code a bit and address a couple of edge cases in the exception handling. Also should make the tuning on the Pinnacle 801e significantly faster.

I seem to have run into a problem though. The tuning fixes I have for the Pinnacle 801e appear to make tuning *so* fast that it seems to have exposed some sort of timing bug in the xc5000/s5h1411 combination. Ugh. I hate timing bugs.

Also, I discovered that both the s5h1409 and s5h1411 driver do not set the spectral inversion properly in the dvb set_params() callback. Most people won't notice or care, but I did because I was trying to track down the intermittent problem I am seeing achieving tuning lock.

And without the s5h1411 datasheet, deciphering the status register is kind of a pain.

I also need to get my latest batch of Kaffeine4 fixes submitted for merge, and see if I can find someone to let me sit in their living for a few hours with a laptop so I can debug why QAM scanning doesn't work in Kaffeine.

Wednesday, October 1, 2008

HVR-950 tuner power consumption

One thing that had always bothered me was how my em28xx based devices are always drawing full power when plugged in, even if the device is not capturing.

It turns out that like the xc5000 driver, the xc3028 driver also had the sleep function commented out.

I can only assume that this was done when loading the firmware took more than ten seconds (I submitted a fix when I was doing the original HVR-950 work months ago that brought it down to ~1200ms).

Putting in the sleep brought power consumption from 520ma down to 185ma at idle (and it properly reloads the firmware when it comes back online)

Will submit a patch after my xc5000 changes get pushed in. I also need to test it with my other em28xx based devices, as well as with a couple of other applications.

I was in the press?!?

Funny story:

So a few days ago somebody sent a question to the linux-dvb mailing list, asking about support for the Pinnacle PCTV Mini stick.

http://marc.info/?l=linux-dvb&m=122219266311519&w=2

Since I did the Pinnacle 800e and Pinnacle 801e support, I replied to the post. What caught my attention was the person used the sentence "Here is the info Pinnacle gave me regarding the devices in the Mini-Stick..." I could hear the sound in my head - "Ding-ding-ding" - somebody with an engineering-level contact at Pinnacle.

So I emailed the person off list to see if he provide the info for his contact. It turns out, Doug is a reporter for the trade publication TV Technology Magazine.

I emailed the Pinnacle contact, and CC'd Doug as a courtesy, introducing myself and asking if they were interested in seeing the Pinnacle Mini Stick supported under Linux.

I figured I should look to see if any of the chipsets are already supported under Linux. So I put "DRX3933J" into Google, and what do I find?

DTV Tuner Briefs: Updates on Pinnacle, Dish, Xceive
http://www.tvtechnology.com/article/67766

Holy crap. It's an article by the reporter saying that I would write the driver if Pinnacle made available the hardware and datasheets.