• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

How to detect if cable is attached to NIC ?

Started by warpcafe, 2008.04.13, 17:34:38

Previous topic - Next topic

warpcafe

Hi all,

some time ago, I noticed that the driver for my T40's built-in NIC displays "media: copper" and the speed/duplex or it displays "media: none" when there is no cable attached. I thought that this could be useful for doing the following during bootup:
- if no cable is attached, assign static private IP
- if cable is attached, run "dhcpstrt" (and, if that fails - assign private ststic ip)

The problem is that I'm missing status / return code information for the "cable attached or not" part: There is nothing similar in lantran.log or I am unable to find it. Does anybody know how to "programmatically" find out if a cable is attached to a NIC (perhaps a generic something) in eCS|OS/2?

Background: I want my notebook to be able to *not* get stuck at bootup with dhcp's "press enter..." and to do dhcpstrt if there is a cable attached... Any ideas?

TIA
Thomas
"It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that"
- G.H. Hardy

ydario

It is possible if you are using the GenMac drivers, os2 native drivers do not support such call.

I wrote a small utility to start xwlan (or whatever you need) when the cable is not present, you can find source code and a binary on hobbes:

http://hobbes.nmsu.edu/pub/os2/util/network/cable10.zip

Yuri Dario

warpcafe

Hey Yuri,

thanks a lot!!
In the long run I will have to switch to GenMac anyway I guess...
Currently, the MiniPCI in my thinkpad is not supported by GenMac (an exotic flavor of Atheros) so I kept the native driver for the wired Intel NIC and saved me from GenMac. But once I get an affordable Intel ABG MiniPCi, I will have to run GenMac anyway. Your software will come in handy then! :)

Again thanks a lot,
Thomas
"It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that"
- G.H. Hardy

ydario

hi,

you can run your adapter with UNSUPPORTED mode, maybe you can get it to work, I know instructions are on genmac mailing list.

bye,

Yuri

warpcafe

Hey Yuri,

thanks for the suggestions!
Unfortunately, that devive is actually recognized correctly, it even manages to turn on the "radio" LED on the thinkpad (in contrast to the crappy windows driver that works but is not "officially supported" by IBM -cough- so the LED does not lite up).

The boot process also works fine.. until... netbind. Then: Dead.
I remember that one of my last desparate actions was to smuggle the working Atheros win driver into the genmac directory and/or to patch it and/or the PCI ID strings, but to no success (almost same behaviour). Ah, just forget it. To save time, I'll swap that NIC for something "better"... aren't we use to be picky about WHAT devices to buy? ;)

Anyway, thanks,
Thomas
"It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that"
- G.H. Hardy

HelenJames

Something alike was discussed on the ask.com,i can give someone a link if anybody need it

RobertM

Quote from: warpcafe on 2008.04.13, 17:34:38

Background: I want my notebook to be able to *not* get stuck at bootup with dhcp's "press enter..." and to do dhcpstrt if there is a cable attached... Any ideas?

TIA
Thomas

On that note, dhcpstrt supposedly has a timeout parameter and flag for error suppression.

In \mptn\bin\setup.cmd should be the dhcpstrt line. Adding a -d <sec> (for instance: -d 20)

Now... supposedly, to suppress the "Enter" message, one sets the d value to 0 (zero). In this fashion (assuming lan0):
dhcpstart -i lan0 -d 0

(the values for this paramter are 0-60)

That will force DHCPStrt to immediately change to "background mode" and not try during the boot process, which supposedly* alleviates the "Press Enter" message on failed DHCP setup. I have no idea how long it keeps trying in background mode though... forever?

  * I have not tried it, so I do not know if it works. Another suggestion I saw (to suppress the message) did not work, so I wont post it here.

At that point, one can have a script or program of some sort to either (a) monitor dhcpstrt and give up on it in x number of seconds (ie: if it's still trying in 60 seconds, kill it), or (b) monitor for connection state (and kill dhcpstrt if no success after x seconds) or so on - at which point a different connection method can be assigned (set up static routing on the lanX connection, retry dhcpstrt if it's timed out, etc).

Don't know if that helps, but it may be a clumsy workaround to create the solution you need.

Best,
Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|