Fixed a stupid bug preventing media stauts to become active.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35019 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -799,12 +799,15 @@ DavicomDevice::OnNotify(uint32 actualLength)
|
|||||||
|
|
||||||
bool linkIsUp = (fNotifyBuffer[0] & NSR_LINKST) != 0;
|
bool linkIsUp = (fNotifyBuffer[0] & NSR_LINKST) != 0;
|
||||||
|
|
||||||
bool linkStateChange = linkIsUp != fHasConnection;
|
bool linkStateChange = (linkIsUp != fHasConnection);
|
||||||
fHasConnection = linkIsUp;
|
fHasConnection = linkIsUp;
|
||||||
|
|
||||||
if(linkStateChange) {
|
if (linkStateChange) {
|
||||||
TRACE("Link is now %s at %s Mb/s\n",
|
if (fHasConnection) {
|
||||||
fHasConnection ? "up" : "down", (fNotifyBuffer[0] & NSR_SPEED) ? "10" : "100");
|
TRACE("Link is now up at %s Mb/s\n",
|
||||||
|
(fNotifyBuffer[0] & NSR_SPEED) ? "10" : "100");
|
||||||
|
} else
|
||||||
|
TRACE("Link is now down");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkStateChange && fLinkStateChangeSem >= B_OK)
|
if (linkStateChange && fLinkStateChangeSem >= B_OK)
|
||||||
@@ -829,9 +832,9 @@ DavicomDevice::GetLinkState(ether_link_state *linkState)
|
|||||||
|
|
||||||
linkState->quality = 1000;
|
linkState->quality = 1000;
|
||||||
|
|
||||||
uint16 mediumStatus = IFM_ETHER | IFM_100_TX;
|
linkState->media = IFM_ETHER | IFM_100_TX;
|
||||||
if (fHasConnection) {
|
if (fHasConnection) {
|
||||||
mediumStatus |= IFM_ACTIVE;
|
linkState->media |= IFM_ACTIVE;
|
||||||
result = _ReadRegister(NCR, 1, ®isterValue);
|
result = _ReadRegister(NCR, 1, ®isterValue);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
TRACE_ALWAYS("Error reading NCR register! %x\n",result);
|
TRACE_ALWAYS("Error reading NCR register! %x\n",result);
|
||||||
@@ -839,16 +842,14 @@ DavicomDevice::GetLinkState(ether_link_state *linkState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (registerValue & NCR_FDX)
|
if (registerValue & NCR_FDX)
|
||||||
mediumStatus |= IFM_FULL_DUPLEX;
|
linkState->media |= IFM_FULL_DUPLEX;
|
||||||
else
|
else
|
||||||
mediumStatus |= IFM_HALF_DUPLEX;
|
linkState->media |= IFM_HALF_DUPLEX;
|
||||||
|
|
||||||
if (registerValue & NCR_LBK)
|
if (registerValue & NCR_LBK)
|
||||||
mediumStatus |= IFM_LOOP;
|
linkState->media |= IFM_LOOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
linkState->media = mediumStatus;
|
|
||||||
|
|
||||||
TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n",
|
TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n",
|
||||||
(linkState->media & IFM_ACTIVE) ? "active" : "inactive",
|
(linkState->media & IFM_ACTIVE) ? "active" : "inactive",
|
||||||
linkState->speed / 1000,
|
linkState->speed / 1000,
|
||||||
|
|||||||
Reference in New Issue
Block a user