OS2 World.Com Forum
2012.05.24, 21:08:30 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to detect if cable is attached to NIC ?  (Read 2969 times)
warpcafe
Global Moderator
Hero Member
*****
Posts: 746


Failure is not an option.


View Profile
« on: 2008.04.13, 17:34:38 »

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
Logged

"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
Newbie
*
Posts: 22


View Profile
« Reply #1 on: 2008.04.15, 11:55:48 »

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
Logged
warpcafe
Global Moderator
Hero Member
*****
Posts: 746


Failure is not an option.


View Profile
« Reply #2 on: 2008.04.15, 14:38:27 »

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! Smiley

Again thanks a lot,
Thomas
Logged

"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
Newbie
*
Posts: 22


View Profile
« Reply #3 on: 2008.04.16, 18:31:06 »

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
Logged
warpcafe
Global Moderator
Hero Member
*****
Posts: 746


Failure is not an option.


View Profile
« Reply #4 on: 2008.04.16, 23:25:34 »

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? Wink

Anyway, thanks,
Thomas
Logged

"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
Newbie
*
Posts: 2


View Profile
« Reply #5 on: 2010.07.27, 13:06:17 »

Something alike was discussed on the ask.com,i can give someone a link if anybody need it
Logged
RobertM
Global Moderator
Hero Member
*****
Posts: 2017



View Profile WWW
« Reply #6 on: 2010.07.27, 19:32:24 »


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
Logged

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

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!