Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've been looking for some sample code, tutorial, etc. for a method to call a BIOS Interrupt from perl. Specifically I'm trying to access the Video BIOS to retrieve the Monitor EDID. If there is a perl module, I haven't been able to find it. Maybe someone has written it or wants to. Any and all help is appreciated. This is in Linux not DOS or Winblows. Thanks in advance. Please also reply to bwalsh@nni.com

Replies are listed 'Best First'.
Re: Calling Interrupts from Perl
by Erik Hensema (Sexton) on Nov 23, 2001 at 15:20 UTC

    It's impossible to call interrupts from usermode Linux. And even the kernel can't call 16-bit BIOS interrupts.

    In Linux there's only one defined interrupt which is the systemcall entry gate.

    However, you may be able to access the video bios: XFree86 does that too. It however would require root access and when X is already running you're screwed.

Re: Calling Interrupts from Perl
by mitd (Curate) on Nov 23, 2001 at 14:12 UTC
    I had an idea that you might be be able to do this via /proc but a test in my environment (Linux 2.4, GForce 2 MX) was disppointing although I was able to retrive the boundary address for the vid card address space. Unfortunately I am using the NON-OPENSOURCED (sheesh) NVidia Drivers so I couldn't look at the driver source for clues.

    But I suspect even if you do have the register addresses in hand for you card you will have resort to 'C' to get grab register info directly or interrogate the driver.

    Update: Erik Hensema is right on. I am so used to thinking in terms my own dev environment where I am grand poobar :). Registers of interest will as Eric points out reside in kernel space and require privileged access. To expand on Eric's idea you could look at Xconfigurator( is this a Red Hat Only thing?) source since it does probe for monitor type.

    mitd-Made in the Dark
    'Interactive! Paper tape is interactive!
    If you don't believe me I can show you my paper cut scars!'

Re: Calling Interrupts from Perl
by blakem (Monsignor) on Nov 23, 2001 at 13:48 UTC
    I haven't posted this is a while, so I'll point you to ESR's guide to asking smart questions, which contains this wise advice:

    Don't ask people to reply by private email:
    Hackers believe solving problems should be a public, transparent process during which a first try at an answer can and should be corrected if someone more knowledgeable notices that it is incomplete or incorrect. Also, they get some of their reward for being respondents from being seen to be competent and knowledgeable by their peers.

    When you ask for a private reply, you are disrupting both the process and the reward. Don't do this. It's the respondent's choice whether to reply privately — and if he does, it's usually because he thinks the question is too ill-formed or obvious to be interesting to others.

    There is one limited exception to this rule. If you think the question is such that you are likely to get a lot of answers that are all pretty similar, then the magic words are "email me and I'll summarize the answers for the group". It is courteous to try and save the mailing list or newsgroup a flood of substantially identical postings — but you have to keep the promise to summarize.

    Update: Yes I *know* it says "also" but its really not a whole lot better....

    -Blake

      Blake, Since you like *public forums*, I thought I would reply to you here. I know what ESR says and keep in mind that he is not god (He lives nearby - West Chester,PA). I put my email in the message and asked for replies to BOTH here and my email. Why? Because I spend a ton of time on various sites and writing Open Source software and wasn't sure if I'd have time to get back here.
      Secondly, Once I figure out hos to accomplish this I intend to write a perl module for everyone to use. I'm hoping to avoid building a .xs in C.

      So - if this sounds like a flame directed towards you - it is sort of.
      I've been working with the Internet since before it was called the Internet, and I just get tired of people in recent time getting so F**KING wound up all the time.
        Perhaps you misunderstood my point... When I came across your node it was on the Worst Nodes of The Day list (at -4), even though it contained a valid question. I was just giving you a friendly nudge to let you know *why* people were downvoting your node.

        At the very least, you should have explained why someone kind enough to answer your question should also shoulder the burden of replying in a non-standard way. "Also send me an email because I check my email more often than I check perlmonks" isn't as bad as "Also send me email because I'm a taker and never plan on coming back." You would have done well to distinguish between them.

        -Blake

        Last time I posted this quote I noted my feelings on ESR (which are somewhat short of godly) but it isn't really relevant what I think of the author....