Announcement

Collapse
No announcement yet.

Get modem status?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clay Clear
    replied
    Lance,

    Sorry for taking so darned LONG to follow up. It's just that
    I've been up to my armpits in programming projects of all kinds.

    I followed your idea of trying the same test DOS EXE both under
    Windows and then under pure DOS.

    The INT 14H routine I had written did not work correctly in
    either case. So, instead of debugging it, because of time
    contraints, I simply completely rewrote it using PB's COMMUNIT.BAS
    DsrStatus's FUNCTION. Once I did that that, it worked correctly.
    Under Windows, it ALWAYS returned the same result for the serial
    ports, regardless of whether the modems were turned on or off.
    It always returned TRUE for viable serial ports, and always returned
    zero for nonexistent serial ports. Under pure DOS, the same EXE
    correctly returned zero for both nonexistent ports AND for existing
    ports where their modems were turned off. For exisitng ports where
    the modems were turned on, it returned TRUE.

    So, I think this proves that your theory is correct, about the
    incorrect repsonses when run under Windows being caused by the
    fact that Windows virtualizes the ports. This should also
    explain why the API GetCommModemStatus DOES work correctly
    from within a 32-bit program, because, since Windows basically, "owns" the
    ports, it should "know" what their stati are.

    Thanks for your insight, Lance. Once again, I apologize for my tardy
    response. I posted this followup so other Forums members can
    see what might be causes to their problems of a similar nature.

    Note that my version of the CarrierFUNCTION also failed to work.
    When I rewrote it, this time using PB's COMMUNIT.BAS's version, it
    worked correctly. Also note that it works correctly also under
    Windows, unlike the DsrStatus function. I do not know why
    my versions did not work. As I said, I did not take the time
    to debug them.

    Tom,

    Thank you very much for your clarification of the copyright
    status of the COMMUNIT.BAS' routines. I am quite happy
    that you commented on them, as I now know that I may use
    them in my production code, which I wish to do, since my own
    versions did not work correctly, whereas PB's did.


    ADDED: The test DOS EXE was run on my Win98SE box.

    ------------------
    Clay C. Clear

    [This message has been edited by Clay Clear (edited October 17, 2002).]

    Leave a comment:


  • Tom Hanlin
    replied
    I'm afraid you have some confusion about the nature of copyright
    law. There's a good casual discussion of the subject in one of the
    files in the Download section-- might be worth looking over:

    http://www.powerbasic.com/files/pub/docs/shrware.zip

    As I said, though, I'll see if I can get the distribution info online.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mike Luther
    replied
    Thanks Tom ..

    The issue is simple. The code in question I think, is:

    '====================================================================
    '
    ' Serial and Parallel Port Routines for PowerBASIC
    ' Copyright (c) 1995-97 by PowerBASIC, Inc. All Rights Reserved.
    '
    '====================================================================
    '====================================================================
    The statement "All Rights Reserved" means EXACTLY what it says it does
    Tom. It means that the complete code in the file to which that
    header is displayed may not be used by anyone for anything without
    the expressed permission of PowerBASIC, as far as this non-lawyer
    knows.

    The key to the issue is what constitutes that expression of right
    to use, where it is displayed, and, for the user of the product,
    a reasonable declaration of where that modified right exists.

    PowerBASIC, as far as I know, does not intend for that total reservation
    of rights to be at all true at all in this case. It *IS* provided for
    use by a licensee of the product to use the example provided. Heck, it
    wouldn't be provided unless that were the case!! But the words do mean
    exactly what they say, to the extent that a modification of that text
    cannot be found in clear proximity of that restriction, to offer relief
    from the restriction for any user.

    No, it's not at all what is wanted. But it stands as written unless
    it is clearly set forth otherwise. You know, a comma here and the
    word "except" and so on ... grin.

    Again, I'm no lawyer. Just an observer.

    To do what is really wanted, I suspect either of two things must be
    present in the medium of distribution or someplace in clear public
    notice. You have to either deliberately modify the EXAMPLE code, file
    by file, to somehow state that the code is proper for inclusion in source
    for a licensed user of PowerBASIC code, or ... it's likely good enough
    for the crew to add a common file in the READ.ME of the source directory,
    or on the WEB site that provides that relief. That common partial release
    statement would likely be something to the effect that, "The right to use
    of all source code examples provided with this product is expressly
    granted for any licensed user of the PowerBASIC compiler toolset to which
    these source files are attached, as may be more expressly set forth in
    the general terms of license for this product or elsewhere."

    Your legal crew can help you draw it.

    I hit this exact same thing with what Clay noted many months ago in
    relation to some of these exact same routines and was forced to do
    exactly the same thing; re-write the whole lot of them just to be
    very clear the 'samples' were not included in my work. I asked at
    the time for explicit relief from that restriction to use the samples.
    No answer was ever given.

    So, I had to do exactly what Clay noted; re-write every single one of
    the examples, variable names, the whole works, just to cover the
    bases. That's obvioulsy NOT what was ever intended by your very fine and
    thoughtful outfit ... But the statement, unabated, is clear.

    Please .. don't shoot the mule. I'm just trying to help.

    ------------------
    Mike Luther
    [email protected]

    Leave a comment:


  • Tom Hanlin
    replied
    The copyright just means that PowerBASIC has the right to set the
    distribution terms, Mike, no more or less. I don't see where this
    is cause for concern or what you mean by "not what's shown".

    I'll be glad to see if I can get the license text posted, though.
    If you're in a hurry, try running the PB/DOS setup-- I imagine it's
    part of the licensing terms you agree to on installation.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mike Luther
    replied
    Tom ..

    I'm sure that what PowerBASIC intends with respect to re-distribution
    rights for the source code samples are obviously not what's shown.
    I think all you folks need to do is to post a blanket policy release
    as is really intended on the web site and on the distribution disk(s)
    that covers it.

    Clay is only concerned on getting it absolutely right and PowerBASIC
    is far too good an outfit to fuss with such a notice glitch-a-poo.
    If legal goes along with the issue, it's trivial to cure what he saw...
    If they don't ... then what he saw really is of concern, one would think.




    ------------------
    Mike Luther
    [email protected]

    Leave a comment:


  • Tom Hanlin
    replied
    I'm not sure what confusion there may be here. If you've paid for
    PB/DOS, of course you can use the samples that come with it, just
    like you can use the PB/DOS compiler, which is also copyrighted.
    They'd be of no value at all if you couldn't use them.

    Considering that you can download the samples right here on the
    PB web site, I doubt redistribution terms are onerous. I can look
    into it, if you'd like.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mike Luther
    replied
    Lance,

    I too spotted this a long time ago... mentioned it then and got no
    reponse at all when I did.

    P.S. If a workable solution is uncovered, I will write my OWN
    version of DsrStatus (and Carrier), because PB included
    a copyright notice in the BAS file.
    Technically, I think he's absolutely right as to the fact that even
    though the stuff is provided, you actually can't use anything!

    Is there a place anywhere in the documentation, or on the Web site,
    where a disclaimer is provided that the routines may be used by
    anyone who is a valid or licensed user of the PowerBASIC products?

    Thanks ..

    ------------------
    Mike Luther
    [email protected]

    Leave a comment:


  • Lance Edmonds
    replied
    To test DSR you need to test the 6th bit in the Modem Status Register... precisely what is done in the "DsrStatus" function in COMMUNIT.BAS.

    However, if you are running under NT/2000/XP, then you're probably getting virtualized port values only, since those OS's virtualize all hardware access to Ring-3 (application-level) programs.

    What level of success do you have on the same hardware but when running in plain DOS mode?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Clay Clear
    replied
    Tom,

    All I know is, the API GetCommStatus (or whatever it's called)
    works correctly in my weather bulletin retrieval program. In
    other words, if one of my modems is turned off, it bumps down to
    the next avaliable serial port. If that modem is not available,
    then it errors out. The 32-bit program checks the DSR status
    to determine if the modem is turned on. First, though, it checks for
    erros in opening the commport, which will be generated if the
    port is already in use by another program. I can't seem to get either
    of these functionalities in a DOS program. <sigh>

    Oh, well, the workaround, 'though quite "inelegant", is obvious.
    Simply have my DOS program create a plain text file that simply
    lists the comm ports to be queried, then call a 32-bit program that
    both checks the availability of the modem, and the DSR status.
    Then it will replace the lines in the TXT file with their respective
    stati. In fact, I can disregard having the DOS program initially create
    the file - it'll simply call the 32-bit program, which will write out
    the stati of all the commports currently on the system, and THEN the DOS
    program can read in the file.

    DSR stands for "data set ready". In other words, is the modem
    available and ready for use? ("data set" refers to the device
    connected to the serial port, NOT the computer ). I *think*,
    anyway. It's been so long since I've read up on modem jargon,
    I can't be certain.

    Thanks for your reply.


    ------------------
    Clay C. Clear
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Tom Hanlin
    replied
    The status registers are a function of the serial port, not the modem.
    It doesn't matter whether it's an internal modem or an external modem.

    I don't remember what the DSR state means, but it may not be
    supported here. Not all serial lines are needed or used by all
    serial devices.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Clay Clear
    started a topic Get modem status?

    Get modem status?

    How would I get the modem status (Line Status Register /
    Modem Status Register values) for external serial port modems?
    In an attempt to find the answer to my previously posted topic,
    I was perviewing the COMMUNIT.BAS file that ships with PB/DOS 3.5.
    I tried the DsrStatus function and it ALWAYS returned the same value,
    regardless of whether the applicable modem was turned on or off.
    I assume that this is because the modem is an external one, so
    the modem status register is in the modem, not in the system memory?
    If that's the case, how would I go about retrieving its data?

    Thanks for any replies.

    P.S. If a workable solution is uncovered, I will write my OWN
    version of DsrStatus (and Carrier), because PB included
    a copyright notice in the BAS file. 'Sides, I prefer to use
    my own rolled routines, and I have already found the applicable one
    under INT 14 in Ralf's Interrupt Lists.

    ADDED: I just tried the COMMUNIT.BAS Carrier function in a test
    program, and it DID correctly return the status of the connection.
    So, obviously, the Modem Status Register can be culled even for
    external serial port modems. So, why does the DsrStatus function
    ALWAYS return the same value? It does so with PB's version, and with
    my own. My version uses the INT 14 call to do it.


    ------------------
    Clay C. Clear
    mailto:[email protected][email protected]</A>

    [This message has been edited by Clay Clear (edited October 07, 2002).]
Working...
X