Slashdot Mirror


Reverse Engineering an MPEG Driver

An anonymous reader writes "Following on from the recent spate of reverse engineering articles, there is an interesting summary of the reverse engineering of a binary only Linux driver. The driver is for the integrated MPEG decoder on VIA's popular EPIA-M boards. At the moment VIA has not publicly released the source code for the MPEG chipset on these boards and will only make the code available under NDA saying that "Typically, only requests from companies developing product for sale will be approved." As a result this is holding back development of open source tools (e.g. xine, mplayer, vdr) that would be able to make use of the interesting hardware on these boards."

23 of 275 comments (clear)

  1. Is this reverse engineering? by bromoseltzer · · Score: 4, Interesting
    He took the binary code and inferred a C language program that would produce the same code. Very clever, but I thought reverse engineering worked on a functional level.

    IANAL, but I don't think the source code is legally safe if VIA wants to go after it.

    -mse

    --
    Fiat Lux.
    1. Re:Is this reverse engineering? by dmayle · · Score: 4, Interesting

      Unfortunately, to be safe, you have to load the library in a debugger, and are only allowed to look at the data being sent to the chip, or returning from the chip. That would be reverse engineering the driver. However, unless there was a licensing agreement prohibiting it, dissasembling the driver to learn how it works is a legal way to learn how to use the chip, so long as your end goal is not writing a drop-in replacement for the library. Think of it like this: Reading from a book on programming is learning, and legal. Copying from a book on programming (whether word for word, or paraphrasing) in order to write your own book on programming is illegal.

    2. Re:Is this reverse engineering? by Anonymous Coward · · Score: 1, Interesting
      That's all very well and good, but there's still the question of legal use of the code that's been produced. It may be perfectly legal for use in Italy, but is it legal for use in the US? Or the UK? Or Canada? Or Australia? Or China? Or Russia? Or...

      If it's not legal for use in a given country, any app that makes use of the code will be illegal in that same country. The best option now would be for one person to analyse the code and post a specification for the Via chipset (not full code -- just enough to allow somebody to write their own code), and then another person to write code based upon that analysis. The hard part is proving that the person who wrote the second-generation code never saw the first generation code, should this come to a legal fight.

  2. Does it work yet? by FryGuy1013 · · Score: 4, Interesting

    To me, it just seemed like a general description of the RE process that people able to RE already know. EPIA M boxes are already good for small PVR boxes using mythtv when a Hauppauge PVR card is added (and a larger power supply). If the MPEG decoder can be used, I'm sure that even the lesser models of EPIA will be able to be used.

    --
    bananas like monkeys.
  3. So he replicated the binary? by Anonymous Coward · · Score: 1, Interesting

    Then what's the point? If binaryA == binaryA, this was a useless exercise. But if binaryA == binaryB, and binaryB is superior, then we have something.

  4. Duh... by plughead · · Score: 0, Interesting

    I can't see that any real thought is required here.

    Boycott the bastards and *most importantly*, let 'em know why.

    A few thousand e-mails to sales@via.com should do the trick...

    --
    If a giant oil company wanted an abortion, would W's head explode?
  5. Re:Free, but not Free by BrynM · · Score: 2, Interesting
    Do you discipline slave code with a CAT5 bullwhip?

    But seriously, you bring up a good point. Companies that GPL or OSS their driver code are doing themselves a favor and saving a lot of the money that would be spent supporting the code later on. I hope that we'll see someone release hardware someday on an open spec with just an OSS reference driver so the community can build the driver from scratch on a new product. Initial sales might be a little flat, but that company could save lots of cash in the long run, have a long product life and actually have the OSS community like them. If I'm wrong and some company is already doing this, let me know. I'll make sure they get prime consideration when I need to buy whatever they make.

    --
    US Democracy:The best person for the job (among These pre-selected choices...)
  6. Not smart by Pres.+Ronald+Reagan · · Score: 0, Interesting

    This seems like a good way to scare developers away from Linux completely.

    --

    Abortion is advocated only by persons who have themselves been born.
    --Ronald Reagan
  7. socialists by Anonymous Coward · · Score: 1, Interesting

    Slashdot makes me just a little nuts. Why should VIA pay to develop anything if they don't actually own the property rights?

    You'all just want free sh|t.

    I'm willing to bet that if you developed something that might be valuable, you would want protection. But you guys all are frustrated little socialists who can't see past your hands. It's only when your dime is on the line that your "rights" are important.

  8. Re:why do it by hand? by zerocool^ · · Score: 2, Interesting

    i often wonder if companies that have cheif coders that are "sympathetic" to OSS users make their products easy to revers engineer.

    For example, if someone made a video driver, refused to release it open source because of contractual problems, but made it relatively easy to pick apart a bit at a time, it would give them plausable deniability, but still help out the OSS community.

    ~Will

    --
    sig?
  9. Why a hardware decoder? - Because - It's a VIA by Chordonblue · · Score: 4, Interesting

    Obviously you've never used VIA processors before. They are notorious for their slow FPU's. In fact, before their latest top-of-the line model - the Nehemiah, their FPU's of previous models always ran at HALF CLOCK. Ouchy.

    But, even at full speed a similarly clocked Celeron kicks it's ass in every which way. That said, high performance is not the stated purpose of the Centaur/Via CPU. Its low watts, coupled with the decoder make for an excellent all-around box. I've built around 7 or 8 of these myself and they are excellent for what they are designed for (think: mom and dad or net terminals, not Half Life 2).

    I have a few of these floating around the school here now as basic net access / workstation terminals and they are hugely popular - especially in light of what they replaced (AMD 300's). There's nothing like tearing apart some ancient computer and putting one of these boards in it. 90% of the time, it's simply cavernous in there (so much space!)

    Last week I put one in an Aptiva and realized that if I was an enterprising person (read: man with a Dremel) I could have fit TWO of them in there as a dual workstation! :O

    So to sum up, they're small as hell (you have to see it to believe it), simple, fun, easy to configure, but don't plan of using them at the next Fragfest 2003 (c)

    --
    "...Well, there's egg and bacon; egg sausage and bacon; egg and spam; egg bacon and spam; egg bacon sausage and spam..."
  10. Re:maybe, but not for that reason by homer_ca · · Score: 4, Interesting
    Another possiblity is that Macrovision copy protection is enabled or diabled in the driver (maybe even by flipping one bit). Macrovision is the analog copy protection mandated by the DMCA. So can't let the open source community break their one bit encryption.

    I believe this is the TV encoder chip used by the EPIA-M and the VT1622M is the one that supports Macrovision.

  11. Re:Free, but not Free by captaineo · · Score: 4, Interesting

    Here are two legitimate reasons a hardware company might withhold driver code:

    1) They differentiate high-end and low-end versions of the same product in software only. I think Nvidia and some storage vendors do this - they sell the same card for $200 and $400, but the driver disables certain features on the $200 part. If they released the source someone could easily find a way to re-enable the "high-end" features on cheap hardware, thus erasing the product differentiation. (which would force the company to sell only the more expensive part, and everyone loses)

    2) Software-based copy prevention, a la DVD CSS, or software-based restrictions, like Macrovision. (I know at least one video card company won't release driver source because it would be obvious how to stop Macrovision from being enabled when a video player requires it)

    I'd say 2) is slightly less legitimate, but I have no problem with reason 1). I'd rather be able to buy cheap but limited hardware than not have the option at all.

  12. Title should read ... by Anony+Moose+Cow+Turd · · Score: 2, Interesting

    Code porting MPEG driver from assembly to C.

    --

    "Too slow chicken marengo" - The Cat
  13. Dxr3 by daserver · · Score: 3, Interesting

    Lets not forget the hardware mpeg2 decoder - dxr3. A lot of people have worked on this and it has resulted in a very decent driver. It has had absolutely zero help from sigma. There is even hacks to make it display rgb directly to your tv, bypassing the crappy composite and svideo.

  14. Re:why do it by hand? by MikeFM · · Score: 2, Interesting

    Still.. the whole point of not releasing the source is to not release the info about the device. They don't release that info because they (or someone they have licensed tech from is delusional enough to think that without the source code competitiors can't figure out that info and thus can't compete as well. Obviously people do figure out that info all the time through various means of reverse engineering.. so all they are doing is making it hard and delaying support and thus sales to non-Windows users that might want to buy their device.

    The MPAA shouldn't care about an MPEG decoder. The only thing I can see them caring about is if the decoder can handle CSS.. and thus need to somehow hide it's keys and such.. which seems a moot point as they've already been cracked.

    --
    At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
  15. Re:Free, but not Free by benjamindees · · Score: 2, Interesting

    3) They plan to license their closed-source driver to OEM's that create standalone Linux products for niche markets, a la Broadcom and Linksys.

    I think this one fits this particular situation perfectly. If VIA can withold the one piece of the puzzle (hardware decoding) that opens the door to easy, cheap, upgradeable DVR boxes and license that piece to lots of different companies, VIA wins.

    --
    "I assumed blithely that there were no elves out there in the darkness"
  16. Re:-1, Wrong by Cooper_007 · · Score: 2, Interesting
    Incredible to see a +5 on an incorrect statement.
    There is only one reason to do this decoding in hardware:

    SPEED

    More accuracy in decoding a stream? In software you can take a variable that's as big as you want. Bigger variable => higher accuracy.
    Additional features? Code 'em up, make a filter of 'em or whatever. Only takes a good concept and some time.

    All these plusses you state as being the reason for using a hardware solution can actually be made using plain old software. The only reason they're not going that route is because if you increase your variable size to get more accuracy, you get a performance penalty. If you make the stream go through filter after filter getting the quality up to snuff, you get a performance penalty.

    The only way to not incur these penalties is by making a hardware part that does all those things without taxing the CPU.

    Cooper

  17. Software Patenting PLEASE HELP by Anonymous Coward · · Score: 1, Interesting

    SAY NO to software patents in europe ....... sign up here : http://petition.eurolinux.org/index_html

    PLEASE HELP URGENT

  18. Re:Theres also VIAEXP... by orv · · Score: 2, Interesting

    Yup, the problem is that VeXP is just a modified and slightly broken version of xine rather than a patch to get the EPIA mpeg hardware going.
    Also, the VeXP code relies on using the VIA ddmpeg binary driver and VIA binary video drivers.

  19. Re:The Wrong Thing To Do by vidarh · · Score: 2, Interesting
    No, it sends the message "release a driver for ANY operating system" and we'll reverse engineer it and buy your hardware...

    It's not like you'd need a Linux driver for it to be relatively straightforward to reverse engineer - most hardware drivers are relatively simple, they act as relatively thin layers to abstract out low level hardware access - and reverse engineering them isn't a big deal.

    The most notable exceptions are winmodem drivers, where the drivers provide more or less a full modem protocol stack, and 3d graphics cards drivers that tend to provide quite high level interfaces to relatively low level hardware primitives.

    If any hardware vendor for more simple hardware devices believe that anyone will have a problem reverse engineering their drivers, they are clueless idiots and will only benefit from learning a lesson.

  20. Re:Free, but not Free by ckaminski · · Score: 3, Interesting

    Remember a year or two ago when turbo-charging your Celerons was all the rage? Intel fixed this with an ondie switch that was lasered shut at the factory to stop this. Nothing, not one thing, is preventing a manufacturer from adding $0.10 to a part for a hard-wired switch that makes a $200 part into a $400 part. If it's in software, you're still taking the chance some enterprising developer is going to figure it all out, and ruin your party.

    Most people, especially saavy ones, are not loathe to trying out new drivers. MANY are very afraid of taking soldering irons to their $200 parts.

    -Chris

  21. Look at it this way by ajs318 · · Score: 2, Interesting

    He owns the hardware; therefore, he has a right to make use of it. The details required to write a driver form a part of the operating instructions for the hardware, and anyone claiming them to be "proprietary secrets" should be laughed out of court with a dusty bootprint on their arse.

    Is it a proprietary secret that "Esc", "K", followed by a two-byte binary number presented units-first between 1 and 480, followed by that many bytes, is the code used to select bit-image mode on an Epson-compatible Dot Matrix Printer? Of course not! why, Back In The Days, when if you wanted software you pretty much had to write your own, the printer would have been useless without such information. So the manufacturers used to provide it in the handbooks. Kit that didn't come with adequate documentation, didn't get bought.

    Today, with pre-written software in abundance, manufacturers are becoming sloppy and not documenting fully how to interact with their products. For the casual user, this isn't a big problem, because they were never going to do anything with this information anyway, so why waste paper or plastic telling them it? But if there is even one user who wishes to do more than what it says on the box, then it suddenly becomes a very big deal indeed.

    My analogy is that he used "reasonable force" to obtain information to which he was entitled, after polite request had failed. The law is quite clear that in certain situations, reasonable force may be used. This situation is more "gentle" and relies less on quick decisions than, say, physically moving a person who is trying to resist. {He could have obtained said information by holding a knife to someone's throat at the manufacturer; this would likely be seen as more than reasonable force.}

    We should be writing to our elected representatives now to make sure it becomes mandatory for manufacturers to supply full hardware specifications, gratis or at cost, to anybody who wants them. Concealing details is a dirty, lowdown, scumbag, coward's trick that will cost companies sales. Please don't betray your cowardice by bleating about "competitors gaining an advantage" - you will have access to your competitors' documents, too, and if your competitors manage to do a better job than you, then you failed it! I have no sympathy, either, for those who whine that people might find it easier to break the law if they were given certain information. It is already more than easy enough to break the law. A few extra ways aren't going to make any difference here or there. You shouldn't rely on doing crap design and keeping things secret; it's another form of corner-cutting. Do it properly or not at all.

    If the guy is ever taken to court, his best chance is to push for a trial by jury an hope that, out of twelve people, he can convince two of them that, although he does not deny what he did, it is the law that is wrong this time and they can acquit him. If this happens often enough the law will be changed.

    --
    Je fume. Tu fumes. Nous fûmes!