Archive for March, 2005

EDID, ReDID. (redux?)

Wednesday, March 30th, 2005

I got the DVI Detective box on Tuesday. It did what it was supposed to do… it advertised a 1366 x 768 resolution at 60 hz. The TV could be turned off and back on without resetting the signal coming from the Mac mini.

However, there was a new problem. Now, certain green and blue hues cause a bunch of fuzzy lines and snow/static to show up on the screen. I’m worried that it’s either the DVI Detective, OR the one-foot DVI-D cable used to hook it up, OR my TV. There is apparently a known issue with the Aquos in which certain gradients between colors cause this pixellation to occur.

To follow up, I’m trying the following:

1) Ordered a new 6′ DVI-D cable with which I will replace the DVI-I cable I’m currently using. This would let me try two things. One, I could see how well the TV works when connected via an only digital signal path. If that still looks okay, then: Two, I could put this in place of their one-foot cable and see if that eliminates the problem..

2) If so, I’ll just have Gefen send me a new 1′ cable. If not, I may need an entirely new DVI Detective box from them. I’m hoping it’s just the cable, because I found this shrinkwrap tubing jammed in the end of the cable.

3) Need to call Sharp USA and ask them how I can determine what my firmware is. This might help them to avoid a service call. If the TV needs the firmware upgrade, then it’s apparently a pretty easy fix; the tech brings a pcmcia card with a file on it. The TV sees the file and uploads it into a permanent flash ram memory, etc.

Sigh. I just want this to work.

EDID, or Didn’t E?

Thursday, March 24th, 2005

When I was configuring a Mac mini for one of my coworkers, I tried connecting it to the DVI input on my Sharp Aquos TV. Its native resolution is 1366 x 768. Using utilities like DisplayConfigX, and custom settings provided by avramd from AVS Forum, it was pretty easy to do. I was pretty happy about it.

Until I tried turning the TV off and back on, or even changing to another input (like, you know, to watch TV?) — Immediately the mini changed to a resolution of 1280 x 1024, and would only show ‘VGA Display’ instead of ‘SHARP LCD’. Yuck. It was scaled and had black bars down the side.

Did some asking around and learned that Sharp’s native EDID information (the info which is sent from newer VESA compliant monitors, to tell a computer what resolutions they support) does not include 1366 x 768. How lame. There are apparently whole pages about issues like this.

Someone suggested that I get myself a DVI Detective, made by Gefen, to solve the problem. This does two things: first, it can be ‘trained’ to use the EDID it’s sent by the device, then that info is locked into memory until it’s retrained. But more importantly, it fools the computer into thinking that the display is always on and constantly connected, and blocks the actual EDID info when it’s sent by the monitor. Theoretically, this is what I need to solve my problem.

I contacted their tech support to make sure, and spoke to a guy who remembered someone else with a Sharp having this same issue. He is even willing to send me a custom-programmed one with a modified EDID for my Sharp which would support that resolution, and with the ‘reprogram’ chip removed. If it didn’t work out, he said, I could always pop that chip back in and give it another go.

So I gave approval for him to program one of these things for me, and am now just waiting to hear back and work out the shipment info…

I wrote to Sharp USA via their website’s tech support link. I asked them what the deal was with the stupid EDID, and whether there was a firmware upgrade available for my TV. I also asked whether there was any way for me to discretely switch inputs via IR; right now the macros I use to change between inputs are kind of lame, because I have to always go through the TV tuner, then a certain number of presses of the ‘Input’ button. And it doesn’t always work, etc…

Eventually I will probably get the IRTrans USB, and a copy of iRed, and just program some custom codes to tell my mini to make the TV switch via the serial port, since that’s a lot less dependant on the IR stuff (less steps which could go wrong, not be interpreted in time, etc.) Then I need a USB hub… etc, etc. It never ends.

foreach his own

Friday, March 18th, 2005

I recently did a system software update in which Presumptuous Apple decided to once again clobber the PHP install. I really dislike how arrogant that is; they just assume that the version they compiled will have anything you could possibly want, so they don’t check to see whether the currently installed version is in any way different from that last one they think they installed, etc. Bleah.

Anyway, enough with the sidebar. I recompiled PHP and got it working, in 4.3.10, only to realize that some of my code was broken now. Great. Further investigation revealed that code which looks like this:

$php_devs = array(“Zeev”, “Andi”);
foreach($php_devs as $this_jerk)
{
print $this_jerk . “\n”;
}

…will fail. In previous versions of PHP, the variable $this_jerk from this example would be a string, and the code above would work. But now, the variable $this_jerk is apparently being assigned an array, which would look something like,

(0 => “Zeev”, 1 => 0)
(0 => “Andi”, 1 => 1)
etc, etc.

So I am forced now to go back and find all of my code containing foreach statements, and change it so it will look like this:

foreach($php_devs as $crap_index => $this_jerk)

and that will work. Obviously, ‘$crap_index’ is a throwaway, since I don’t care about the index.

I could understand if this were done with great fanfare and many warnings, in PHP5. And from looking into it, it appears as if this were backported into the PHP4 source tree as an attempt to make the code execute more quickly. But to break existing code like that? That’s just moronic, and it makes me want to do less with PHP.

Virtual DVHS, Part III

Friday, March 18th, 2005

So I hacked in the menu items, and they worked fine… sort of. I clicked ‘Play’ (or pick the menu item… or hit ‘P’, heh heh) while Input 5 (compy) was selected, and the i.Link mode ‘took over’ the display. Sweet. Then I hit ‘Stop’ (Actually, I had to press ‘S’, etc.) and it stopped. Sweet.

Except when it stopped, it didn’t return to the last Input. It just went to the digital TV tuner. Which I guess makes sense, because i.Link MPEG Transport Stream decoding is almost the same thing as showing live digital TV, there’s just a slightly different source for the stream.

This made me realize that the last thing I wanted to add was the integration of serial port control, strictly optional of course… since I’d already had success with that. But I opted to make it a little more generic, in case anyone else wants to use this for some other purpose.

I added a few NSStrings to hold paths to a user’s ~/bin directory, plus ‘vdvhs_on_stop’ or ‘vdvhs_on_play’, and matching bools to note whether there was an executable at that location. The applicationDidFinishLaunching method is where those checks are performed.

Then I created methods to execute the shell scripts, if they existed, by using the system() call. I initially had problems with these because I didn’t realize I had to retain the strings after I set them. So I was having an autorelease problem. Trying to access my NSStrings’ contents, and conver them to cStrings, was causing the program to crash with signal 11, SIGSEGV. When I went in with the debugger, I was able to see that the contents of my NSString was ‘Invalid’, and that was a big clue.

Once that was fixed, it worked pretty well! I’m on the fence about whether to use the ‘play’ script in my personal setup; if you switch to i.Link mode using the remote, or serial controls, it puts up the on-screen transport control (play, pause, etc.) and that’s kind of annoying. I did program the universal remote with the i.Link button (so as to get it off the screen) but I don’t know if I’ll use it that way or just disable the ‘play’ command shell script. Either way, I was pretty geeked when stopping the program also switched the TV’s Input back to the Mac. So, mission accomplished!

This is fun, but also kind of scary. I actually found myself looking over this page, which is Seth Mattinen’s recounting of his own experiences hacking on vdVHS, and wondering, “Hmm, how would *I* implement those features… wonder if he’d give me some advice…” Heh.

Virtual DVHS, Managed

Wednesday, March 16th, 2005

I believe that I finally have hacked together a version of Virtual DVHS that does what I need it to do… including keyboard control with hotkey equivalents (no modifiers).

I finally managed to flag down someone else from #macdev who was able to help me with my code. Turns out I needed NSWindow in place of NSResponder, and didn’t need one of the methods I had in there. In Interface Builder, I had to pick the ‘Window’ and choose my Custom Subclass from a list. I was… sorta close?

Anyway, I got it working with spacebar (play pause) and escape (stop), but the problem was, only if I didn’t actually click on anything in the window. As soon as I did that, my methods (attached to a custom subclass of the NSWindow) lost focus and stopped working.

My next thing to try was to use a menu, with hotkeys instead. I eventually figured out that the terminology is ‘Submenu’ to add a new menu, and ‘Item’ to put something in it. I created a Control menu, and Play, Pause, and Stop items. Made each of them corresponding IBOutlets in the .h file of the controller class.

The last thing to do was, connect these items to the same IBActions that clicking the buttons did… and also setting the ‘enabled’ state of each menu item in the same places where the button’s states get set, eg: [playMenuItem setEnabled:YES];

In awakeFromNib, I also had to tell the menu to setAutoenablesItems: NO. Apparently that’s so I can set their status myself, instead of them being enabled by default if they have a target action associated with them.

Can’t wait to test it when I get home. Just in time for the arrival of the Mac mini!

Anyway, the source and compiled binary can be found here.

Ups and downs of Virtual DVHS

Tuesday, March 15th, 2005

I saw a post in the AVS Forums which caught my eye. Well, my iEye, to be precise. It quoted a mention on xlr8yourmac’s daily news from one Graham Jones of Toronto. He was looking for beta testers for his new EyeTV helper app. I wrote to him and told him about my situation.

In particular, my interest was in this feature: “Create aliases to Mpeg files with descriptive file names.”
My thinking was that maybe this could be used with Virtual DVHS. I did some testing and determined that I could not make aliases ending .m2t to actual mpg files in my eyetv library… but I can use softlinks (which is more of a unix, less of a mac, thing).

Contacted Graham with this news. Then I realized (by picking through the source) that unless Virtual DVHS were not open already, it wouldn’t see any new files added to its media folder. So I started hacking on it.

First I made a method that I called TStreamIsKnown, which when passed a ‘stream’ object (a NSMutableArray containing filename, size, last mod date) checks to see if we already know about this stream (eg is it already in our global availTStreams list, which is itself an NSMutableArray.)

Then I added a check to the existing findAllTStreams method, which is what actually looks through the ‘media library’ folder the user specifies, and populates that availTStreams list. (The list is then used to populate the NSTableView called ‘availableTransports.’) The check I made is a call to TStreamIsKnown before adding the stream in question to availTStreams. That way, if findAllTStreams is called again, it’ll skip any files it already knows about, and instead just add the new files it finds (at the bottom of the list. Sorting be darned.)

Next, I added an NSButton, labeled “Refresh”, right above the availableTransports NSTableView, and linked it to a new method refreshFileList, which in turn just calls [self findAllTStreams]; . Then someone suggested that I also add a new NSApplication delegation for applicationDidBecomeActive. So once again, I just linked that to the same method, [self findAllTStreams]; .

Then I just mucked around some more in the Interface Builder and added some hotkey equivalents to menu items like Preferences (cmd-,) and Hide Others (opt-cmd-H) which should’ve had them in the first place.

The last part of this project that I’m embarking on right now would seem (to me, anyway) to be one of the easiest things to do: making the space bar toggle play/pause, and the escape key hit ‘stop.’ This is important to me because when I connect my Mac mini to the DVI input on my TV, I switch to ‘input 5′ to see it. But as soon as I start sending it a transport stream via i.Link (using Virtual DVHS), it ‘takes over’ the screen, much like pressing play on your VCR would cut off whatever channel it was tuned to. Hitting the ‘stop’ button returns you to Input 5… but wait, that’s an issue, because we can’t SEE the stop button in order to click it. And that’s why some keys like play / pause and stop need keyboard equivalents.

But so far I’m having a lot of trouble with it. And once again I’m running into some grey areas of Apple’s HIG: should Full Keyboard Access (something I normally love) interfere with my ability to catch keyDown events? Look at QuickTime Player. It doesn’t appear (to me) to support Full Keyboard Access at all, and spacebar is start/stop in that application. Then look at EyeTV. Yes, it’s kind of a hack, but they just map space to the ‘play’ command in their Controls menu. Wondering if this is what I should do instead.

The advice I’ve gotten so far is that I should subclass either NSApplication (Apple says in their notes that doing this can be a big pain) or NSWindow, so I decided to try subclassing NSWindow. Then I added a call to make it ‘first responder’, which I guess ups its priority in the call chain to receive keyboard events..?

Right now I’m kind of bogged down trying to understand what to actually change in the Interface Builder side of things. I asked a few times in #macdev on freenode, but I’m not feeling like I’m getting very far. Either I’m really close to getting it or I’m going about it all the wrong way.

U2 iPod Sucks.

Thursday, March 10th, 2005

Enough said.

The Amazing Race

Wednesday, March 9th, 2005

This is one of the few reality TV shows that I find to even be worth my time. It’s eleven teams (so far, couples, but in season 8 I hear they’re looking for families of four) on a race around the world. They might be dating or married, young (mostly) or old, gay couples, sisters, mother/son, best friends, etc. Each week, whoever finishes last might be eliminated. (Might, because four rounds are usually non-elimination rounds. If you come in last in a non-elimination round, they take all your money but you get to keep racing. However, you may have to beg the locals for spare change to get your next bus fare or whatever.) Along the way, there are a series of challenges that one or both people must do.

I like the show because you get to see a lot of different places and many of the tasks are things that the people who live there, do for a living. They will stop in many historic landmarks like churches, temples, etc. and often the locals will be decked out in their ceremonial garb to welcome them, etc.

Of course, the thing I don’t like about it is the whole ‘reality TV’ aspect of it: people whining at, and about, one another. There always seems to be that one couple that fights bitterly. (Season 5, it was Colin and Christie. Season 6, Jonathan and Victoria. In Season 7, I think it’ll be Ray and Deana. “Suck it up!”) It’s seriously painful for me to watch it… just not the kind of TV that I enjoy. That, and how utterly ignorant some of these people are about customs, currencies, and the fact that speaking your own language SLOWER AND LOUDER does not magically translate it into the language of the person in whose country you are a guest. (…jerk.) No wonder people think so highly of us.

When looking for the Amazing Race website just now, I saw another site which claimed that a disproportionate amount of betting had happened already on one particular team. Which could mean that they’d spilled the beans (or not.) I would hope that whoever is involved would get the money kept from them, like that confidentiality contract they sign on Survivor.

Anyway, I enjoy watching the show and what really makes it worthwhile is the people we watch it with. There’s a group of about five or six different couples who have all, at one point or another, hosted for Amazing Race. We’ll order pizza, drink beer, and most importantly, make fun of the show (think TWOP.) There may be, from time to time, the harmless wager, but I am assured that it’s all just paper money.

Edirol UA-1X: Two thumbs down

Wednesday, March 9th, 2005

I got the Edirol UA-1X last week and tried it out. It was quite simple. It certainly did come up as a sound output device, but not a digital output device. I could connect it to my stereo and use it as a way to kick 48khz sound out from the computer, but aside from that, I didn’t see it being possible to pass DTS or 5.1. Their tech support gave short cursory answers which did not answer my questions.

My two main goals for the device (using it with Apple DVD player, to pass 5.1 and DTS, and using it with ElGato’s EyeTV software to export sound, especially surround) both rely on having a device which can register with the system as, and act as a, digital output device. So, it utterly fails to meet my expectations.

Caveat emptor!

Serial TV watchers

Wednesday, March 9th, 2005

Using a USB to Serial port adapter, I was able to launch ZTerm and issue commands to the TV; change channels, switch inputs, switch tuners, etc.

That much worked. Trying to write a quick program to automate this, has failed thus far. It looks like the program is opening the serial port, however briefly, but the commands aren’t working (and I haven’t put in a mechanism yet to provide feedback.)

Wrote to the guy who wrote the interface (pyserial) and he got right back to me with some helpful hints about it. So I’ll try his suggestions… but I don’t have as much hope that this will be a quick, easy solution. We’ll see…

* * *

Wow, an incredible turn. Got much easier. Added a serial.read() command at Chris Liechti’s suggestion, and increased the timeout to three seconds. And it worked! I was amazed that it was that simple.