19 October, 2012

Google Profile: Bragging Rights: Hardware Hacking

When you're a member of Google Plus (G+), there are a lot of things one can fill in about yourself.  If I recall correctly, the only ones which are mandatory are a name and gender (and even disclosure of gender can be controlled).  However, there are lots more categories available, such as education, employment history, and so on.  The one I'd like to focus on here is "bragging rights," and fill in some detail which is not on G+.

Way back in the day, my friend Karl had an IBM PC-AT work-alike, with a 80286 processor, a 1.2MB 5.25 inch floppy, and a 20MB Seagate MFM hard disk.1  Karl ran mostly PC-DOS (or was it MS-?  not sure), and DesqView, and all sorts of neat hacks like that for quite a while.  But he thought he would take a chance on a recently published OS, MINIX.  That was great; he let me have an account on that and mess with it while I was visiting.  But it had quite an issue.  There was no way MINIX (or even something like a home directory) was going to fit on 17 disk sectors, which is all the hard disk would accept before erroring out.  That, if you old timers will recall, was merely one track (on one side of one platter), not even a whole cylinder.  So, at least for a while, Karl and I had to be content with operating off floppies and a RAM disk.  But it kind of bothered me...how could they even publish a disk driver if it worked so poorly?

It just so happens his father was a computer consultant type, and as such, had access to or copies of all sorts of technical references, one of which was the programmers' manual for the hard disk controller.  So, I went about studying the controller registers and such, and trying to deduce what the disk code in MINIX was doing.

Lo and behold, there was a certain disk controller register which held head number, cylinder number...y'know, that sort of thing, to read or write.  In essence, it embodied how to cross track and cylinder boundaries, and it was divided bitwise.  When I looked at the driver code, it all seemed to jive fairly well with the tech manual.  But what's this I see?  The various "coordinates" are being assembled together in the assignment of a variable, with various "&" masks, and shifting, and whatnot, but there is a "||" in the code...or a Boolean OR.  Wait a minute...this register needs this in these bits, and that in those other bits...hey, that Boolean OR should be a bitwise OR, or "|" instead!  Jiminey, if we didn't edit the disk driver source, recompile the kernel, and all the sudden more than 17 hard disk sectors became accessible!  Success!  I hacked the hard disk driver!

Of course, this was just as a hobby then, although I was studying for a computer science degree at the time.  I actually had a chance a few years after that to do hardware hacking professionally.  My job was to write some pieces which would facilitate voicemail system vendors' integration with the Simplified Message Desk Interface (SMDI) protocol.  This involved writing a character device driver for MS-DOS which would take in data from a serial port and store it for retrieval by the voicemail software.  One of the major lessons learned there was that sometimes manuals "lie."

In the interrupt routine for the serial port, I would read the status register which contains bits for control lines changing (say, losing carrier detect), for character written, for character received, and whether there were any more interrupts pending.  On some systems, I would wonder why data stopped being received from the phone switch, and thus making my routines reject the SMDI data which were being sent (format errors, basically).  It turns out the "interrupt processing done" flag bit was being set, even though the "character received/ready" bit was set also!  It was a definite sign that either some of the UARTs were not interrupting enough, or interrupts were being lost.  I stopped relying on the "done" bit, and checked each bit individually.  It seemed less efficient to have to do that, but every once in a long while we come across this need to work around hardware bugs. I also ended up additionally hooking the timer interrupt, so periodically there was a double check for reception of characters.  At 1200 bps (or 120 characters/second), and timer ticks at a little more frequent than 18 Hz, it was enough to make almost all the reception errors go away.

I've also had a long-term interest in Linux internals.  Really, the build scaffolding for the Linux kernel has become very refined over the years, making it very easy for anyone with a minimum of system skills to tinker with the kernel.  I used to want to optimize the booting time by going through the configuration and including only the bare minimum to get init going, which meant basically console, disk, and root filesystem drivers, and everything else possible as a module.  From there, anything needed by init or beyond could be demand-loaded by the kernel merely by triggering a module load through accessing a device node.  (Of course these days there are facilities to enumerate all the hardware present, such as scanning PCI and USB buses, and everything gets loaded and initialized, kinda whether you wanted it initialized or not.)  But I needed even a little bit more control of my kernel than that (no pun intended).

I had bought a serial card for my computer, four ports, two populated with hardware with sockets for two more sets of DIP chips.  It was also capable of being clocked at four times the standard rate, making it capable of 460800 bps.  The thing about x86 Linux at the time is that it had no accommodation in the serial driver for rates greater than 115200.  Oddly enough, the system header files defined constants for the termios interfaces for B230400 and B460800, but they were never used in the serial port driver.  Well...since I wanted to drive my US Robotics Courier at the top speed of which it was capable, 230400 bps, I put some additional code in there to handle the higher, nonstandard rates.  Build, install, run the bootloader installer, reboot, and wouldn't you know...it actually worked swimmingly.  I was thrilled to be a minor, successful Linux kernel hacker.

In yet another incarnation of my main Linux system, I couldn't use that ISA 4 port card (it has only PCI slots), so I got a Keyspan USB to four RS232C port adapter.  These are also capable of more than the standard 115200 bps, and again, I wanted my Courier to operate optimally, so I decided to sling it off the USB adapter.  And that was great...except for one problem.  When I would dial into my system, all the lines in my session would "pile up" at the last line of my terminal (emulator).  "That's odd," I thought.  If I attached the modem to the standard, chipset serial port, things were just fine, so I knew it wasn't my kernel per se.  I was able to track it down, in that the terminal driver checks each outbound character for "\n", and if the right output termios bits are set, it inserts an additional "\r".  I traced this all through the terminal driver down to the kernel, and back up through the USB serial driver and the Keyspan driver.  None of it made sense.

I actually posted my findings of this misbehavior to a newsgroup, asking what would be the wisest way to fix that.  The reply was kind of disappointing.  In essence, it was, yep, we know it does that, and the reason is the packetized nature of USB transfers.  Adding that additional character ("\r") presents a timing problem in that the character(s) preceding that have already been "in flight" down the USB, so it would be difficult with the existing architecture to be able to accommodate that (atomically) in the output.  I can say that although I wasn't able to fix it, at least I had the satisfaction of knowing I was able to pinpoint the exact cause of the misbehavior, and just lacked the knowledge of USB to handle it adequately. Ultimately, the times I would be dialing in for just the terminal mode would be really rare (would much more often dial in to use PPP instead), so it really wasn't worth the effort to fix it. It was simply easier to adjust the terminal program to add a LF for each received CR for a call to my system.

1For you youn'uns, this was in the days where the mainboard had lots of Industry Standard Architecture (ISA) slots, and very little was on the mainboard.  Your parallel printer and serial ports were on one card, your graphics controller on another, your floppy controller on another, and your hard disk controller on another.  This had the advantage of functional isolation--if your floppy controller went bad, you could swap out just that; these days, it's all wrapped up into the mainboard chipset, and the whole mainboard has to be replaced.  It also allowed the system builder the ability to engineer the system better.  For example, if the standard two serial ports was not enough, just get a card with say eight ports instead.  But I digress; the point is, hard disks were relatively expensive back then, and most systems had only floppies.

Direct all comments to Google+, preferably under the post about this blog entry.

English is a difficult enough language to interpret correctly when its rules are followed, let alone when the speaker or writer chooses not to follow those rules.

"Jeopardy!" replies and randomcaps really suck!

Please join one of the fastest growing social networks, Google+!

11 October, 2012

Things One Needs to Realize About Jobs

I want to lead off with the usual disclaimers about how I am not intimately familiar with what went on, just to make sure everyone knows that.  I can only comment on what I have been able to gather from around the 'Net.  You have been warned up front that this is nearly purely commentary.  Both sides in the long story I'm about to relate seem to have just cause.

I've continued to hear a lot of talk over Erik Lanigan and his departure from the TWiT netcast network.  I know there are a lot of Erik supporters out there, and probably, if you had to come down on TWiT's/Leo's side or Erik's side, there'd probably be more people on Erik's side.  However...if Erik had a little bit more experience (and I mean life experience, not necessarily radio/netcasting or TWiT experience), he'd have known it's not exactly good form to criticize publicly those who are employing you.  I learned this early on when I was working at Radio Shack, when my manager told me, that's fine, you can talk about this and that, but do not "talk shop" in front of the customers.  Not only did I correct my behavior for wanting to keep my job, but I agree with that assessment.  As a customer, I don't want inside squabbles going on in front of me.  I've had it happen in front of me in some of the shops I've been.  Yes, it's important to talk about immediate operational issues (e.g., my cash drawer is out of quarters), but if there are personal opinions about how the shop's being run, the discussion absolutely should not be taking place in front of strangers to the situation.

Erik's beefs may be totally legitimate.  He may have been lacking a paycheck.  He may think he's being overworked and underpaid.  But there are a few lapses in thinking and judgement on Erik's part.

1. Going negative is rarely good, at least not in public.

People will not take too kindly to being badmouthed in public.  And you're not necessarily going to curry any favor by being negative either.  It doesn't matter how generally right and just you may be.  You may be seen simply as a whiner and complainer.

The better solution many times is not to complain but do it yourself.  As some have suggested, take your talent and out-TWiT TWiT.  Mr. Laporte has many times on TTG told of how broadcasting is not as it used to be, needing to go hat-in-hand to a bunch of guys who have spent mounds and mounds of cash on transmitters and satellites and such.  The Internet is a whole lot more wide open.  Radio is waning in significance (albeit slowly).  Think of how in the  present day there is considerable money going into Internet exclusives (YouTube and Netflix productions).

2.Yes, finding a job is a pain in the behind.

I know that all too well, having been laid off 21-May-2010 and not having had anything except a 12 week contracting job since.  But the fact of the matter is, you've got to think critically about how much effort you want to plow into making your current gig better.  Could this effort be better focused on doing the job somewhere else, or maybe doing some other work?  And again, do you really think discussing that critically to anyone except your employers is going to help?

What...you want to try to amass a proverbial  army to storm the castle which is your employer's operation?  Yes, it might work, especially if there is something along the lines of human rights violations going on, but this would generally apply to more than one person--by forming a union for example.  (And those who know me know I don't like unions in the least.  However I have to look at history and say that there are some industries which likely would not have been changed for the better without them.)

In other words, you have to know when it's time to cut your losses and move on, and when you truly have a terrible labor problem.  If Erik had such insurmountable labor problems, I think he would be much better served by entering into talks with the California Department of Industrial Relations, Division of Labor Standards Enforcement (what would be the NYS Dept. of Labor for me, I think).

3. Complaining about the past will not change the past.

Only some twist of quantum physics which allows us to create a TARDIS will help that at all.  Do not ignore history, but use it only as a guide to improve the future.  Dwelling on the past usually only hurts the dweller, not helps.

4. Consider carefully for whom you want to work.

Consider it not only from the perspective of your personal gain, but also try to consider future issues which may arise.  Unless you're the top of the heap (like Leo, or possibly Lisa) you never know in what direction any outfit will be going.  You can only make guesses based on past history.  You never know when you'll be associated with something you'd rather not be.

I understand these sorts of things, surpisingly for some, from an employee's perspective, not as management.  I've never been anything more than (well, male version of) a worker bee.  (Scientists tell me worker bees are female :-) . )  I think I agree with Mr. Laporte, this was not necessarily a good fit.

I've seen Erik's 0:39:40 long YouTube edit of his side of the story which I suspect does not include everything.  Of course, why would it?  It's Erik's perspective on the story, and it will be either deliberately  or subconsciously edited to make Erik look the best, and perhaps by implication, TWiT not so hot.  However...considering the repetition used in this video, it seems quite a bit more slanted towards deliberate than subconscious.

But the thing is, Leo is also somewhat guilty of some of the same issues.  When confronted during "The Tech Guy" to explain why Erik was no longer doing his show, it would probably be far better simply to have stated Erik and TWiT were not working out as a combination, we didn't agree with some of the things which were said/written and done, and so this is the direction in which we went.  And that's as far as it should have prudently gone, referring any persistent inquisitors that they're private, internal TWiT affairs.  But instead, it was somewhat of a counterattack when Leo went on to say things about compensation, about what was written on the main TWiT IRC channel ("chat room?"  pish.  Call things what they are.), and operational issues such as fiddling with the controls.

We generally societally don't talk about compensation.  The fact that Erik brought up dollars in IRC and Leo also commented on it on mic during a TTG break are fouls on both sides.

That Erik and TWiT didn't see eye-to-eye on how to run Erik's call-in show should have been the end of it.  I know it was just a sort of "natural" commentary on the state of things, that call screeners would help, but once again, it's poor form and rarely helpful to comment publicly on such operational issues.  Unless the topic of the show is you, it would seem far better to bring this up with the powers that be instead of commenting on it on the show.  At the very least you'll be perceived as a whiner.

The fact that Leo was talking among others on the staff about locking down the controls to me is a bit telling of growing dischord between the parties.  Although...if Erik could have adequately demonstrated the abilities of the system to revert things properly (and I stress "properly" because things don't always work as documented, or work consistently), it's TWiT's fault for not using their capabilities to the fullest.  So what if Erik twists every single virtual knob to something unsuited for the other shows?  If it serves Erik's show well, and it can more or less be reverted to whatever you want it to be easily, rapidly, and consistently, why lock him out?  Still, Erik has to realize whose knobs they are, and respect the owners' wishes, and the owners shouldn't have to result to such things as the access controls being discussed.

Transparency is generally thought to be beneficial to all.  The argument will probably be made that the more transparent, the more out in the open the whole affair could be, the better.  I would also in theory be in favor of everyone on both sides being able to core dump their experiences, and let me decide, if I had the inclination, who/what is better.  But let us not forget transparency can work to people's detriment, and people don't necessarily want to be transparent.  That's why the US Constitution has its Fourth Amendment.  In a perfectly transparent society, the 4th wouldn't be there.  But in practice, very few people want such perfect transparency, hence the existence of the 4th.  The thing is, in practice it's rarely prudent to air all these gripes about the other party.  It's often far better just to move on and just chalk it up as another experience.

Again, it's not necessarily my intention to be critical, but I want to speak some more to point 4 above, about the character, as I see it, of Leo Laporte.  Yes, this will have a complaining tone to it of sorts. I realize that, and that it's somewhat contradictory and hypocritical, but I feel I must put it forth anyway.  After all, I did say this was an opinion piece.

I've written on Google+ before about a taste of Leo's irresponsibility.  I for one just find it difficult to fathom why he finds it so impossible to hit every single live read.  Sponsors are more-or-less his customers, albeit indirectly, and their needs I would think should be paramount.  If necessary, he should devote some time either to searching out some software to help him out, or indeed since he says he's a programmer, coding something himself.  He interrupts all the time for hard breaks.  He has no choice whatsoever (that's why they're called hard breaks).  Why he cannot take control for a moment and even interrupt a call if necessary and do his live reads, I do not understand.  However, it seems most times he just plum forgets that, "hey, this is a segment 4," and just goes on to another caller.  Then he ends up doing a live read as the last part of the segment, and what good is that if it's followed by more ads?  Might as well just integrate it into the stop set (block of ads) near the end of the hour.  And I can't imagine the sponsors are pleased when their ad time gets somewhat truncated because Leo is in a live read and the hard break sounder comes.  (Of course I'm imagining they aren't too pleased either when their spot does not air in the segment which I presume the traffic department told them it would.)  Idunno...it's pure speculation on my part; maybe they don't care as long as it airs sometime during the show.  That seems to be the prevailing attitude of Leo and the Premiere board op(s) (Luis, then Kyle, then Nathan).

Again, transparency might not be the best.  Leo seems to think it's all the best all the time.  He seemed to have no qualms talking about how his wife and he are separated.  I also recently read about how Abby was none-too-pleased about Leo talking about her college, her illness, and so on.  Also, granted, I haven't been following California public records to look for it, but Leo has not yet said anything about divorcing his wife.  I can just say I make a value judgement on this one, that I think it's improper that he be doing anything besides TWiT with Lisa...at least not until he is genuinely single again.

I personally don't like how he talks over callers sometimes.  I know; I've been there, and tried (unsuccessfully) to get a point in edgewise.  It's also a reality that often this is necessary due to the very nature of some callers.  It's a necessary evil, if you will.  All the same, it seems rude a lot of the time.  Of course, there are some in the biz (Mark Belling springs immediately to mind) who are worse.  (I will not listen to Mark past any monologue when he is substituting on "The Rush Limbaugh Program.")

Color me surprised, but he's also talked openly about how he's disturbed his apartment neighbors with his sound system.  Speaking as someone who lived under two sets of tenants (among 5) who couldn't seem to grasp this concept either, this is something one just plain does not do.  Barack Obama said similar things about his college days; yet one more reason I don't like him.  Both of them ideally should have known better.

Leo has also made it publicly known he spent unbelievable gobs of money on the TWiT Brick House, close to $1 M or perhaps beyond, if memory serves.  Then not too long ago he also let on how he had to start watching his pennies perhaps due to this.  Huh?  I mean, another theme talked about from time to time, sometimes during TTG, sometimes during network breaks, is how netcasting is mostly a labor of love and how there's typically not a whole lot of money in it, and how it's sooooo tough to get sponsors.  Of course I'm not privy to their ledgers, but they seem to be talking at odds there.  How can this be such as tough-to-sustain business, and yet you have the budget for a million dollar studio?  (Actually, Leo didn't; he has talked about how the budget was a lot more modest in the beginning.  I do not know what led him into exceeding it.)

So to wrap up point 4, do you really want to be working for someone who has such openly suspect character, Erik?  Maybe it's much for the better you two separated.  If despite that you still wanted to work for them, it would seem keeping your concerns private and not airing it all out would have been more prudent.

Yet, despite all that, it's obvious Leo is successful.  He probably has millions of followers and fans due to Premiere Radio Networks.  There are also exceedingly few people who can claim to have won an Emmy.  I have to admit he is entertaining and informative too, otherwise I wouldn't be spending around 6 hours per week listening (to TWiT's stream), plus occasionally other downloads like "Security Now!"

Direct all comments to Google+, preferably under the post about this blog entry.

English is a difficult enough language to interpret correctly when its rules are followed, let alone when the speaker or writer chooses not to follow those rules.

"Jeopardy!" replies and randomcaps really suck!

Please join one of the fastest growing social networks, Google+!

04 October, 2012

Finally...there's a radio station which carries Glenn Beck which "gets it..." at least partially: KYKN Salem, OR. First, I'd like to relate what they don't understand, so I can end on a positive note: people are usually adult enough to be able to choose whether they want new windows, new tabs, or the same window; DON'T use window.open(), it is EVIL. Now, what they "get" which other radio stations don't seem to have the faintest idea of how to grasp: IT'S RADIO, WE DON'T "WATCH" IT.

Sooooooo many stations offer a stream, for which I am actually really grateful. Glenn is not carried live locally, and the semi-local station (WHAM-AM) which does carry him delays him 14 hours (2300 local time), and then only carries the first two hours until Coast to Coast AM. BUT...the vast majority of these streaming stations wrap their stream in Flash, or Silverlight, or...well, use your imagination...as well as JavaScript. Leo Laporte recently explained this to a caller on "The Tech Guy" radio show. This is ostensibly to show ads along with the program. To the radio station execs, programmers/PDs, and Web programmers: knock, knock, knock, McFly? You in there? It's radio, not TV. We throw it up on the tablet, iPod, phone, or desktop, and we (here's a shock) LISTEN.  We don't see the ads.  In fact, it's common practice for Android apps (such as IHeartRadio, TuneIn, PSA Stream Media Player, etc.) to allow the audio to keep flowing even though the app does not have focus, and I'm looking at my launcher/home screen (or any other app for that matter).  Your ads are therefore virtually useless.

KYKN on the other hand seems to understand this, and simply provides 4 links directly to their streaming provider (for 4 different formats: MP3, Windows Media, RealPlayer, and QuickTime).  Finally and at last...I can automate starting  the stream, with a simple
mplayer -playlist http://panel7.serverhostingcenter.com/tunein.php/jsktech/playlist.pls
I'm sick of most streamers (e.g., radio stations) making me pull up Wireshark to analyze the net traffic interaction with their "players," many times which lead to unusable results (such as inability of MPlayer to handle their stream).  What would be even worse if is they choose to encrypt (HTTPS) their interactions, but I'm not sure I ran across too many of these.

It's just evil, and many times quite pointless.  Get rid of the Flash, or at the very least, also provide direct links to playlists, or even better, the compressed stream itself.  Besides...even Adobe has basically told the world, Flash is being phased out.  Also, there's nothing like telling a couple million customers (who have Apple products, which never supported nor never will support Flash) to go pound sand.

Direct all comments to Google+, preferably under the post about this blog entry.

English is a difficult enough language to interpret correctly when its rules are followed, let alone when the speaker or writer chooses not to follow those rules.

"Jeopardy!" replies and randomcaps really suck!

Please join one of the fastest growing social networks, Google+!