How can i get PHY link status from user space for plug/unplug the network cable in QorIQ SDK1.9 with p1010 board

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can i get PHY link status from user space for plug/unplug the network cable in QorIQ SDK1.9 with p1010 board

1,045 次查看
jungong
Contributor II

Hi to all,

How can i get PHY link status from user space for plug/unplug the network cable in QorIQ SDK1.9 with p1010 board?

Thanks.

0 项奖励
回复
2 回复数

808 次查看
Pavel
NXP Employee
NXP Employee

Look at the following page in NXP community:

https://community.nxp.com/thread/332932

 

By the way, this works exactly the same on my host Linux PC:

 

With Ethernet cable connected:

 

cat /sys/class/net/<iface>/carrier

1

 

With Ethernet cable disconnected:

 

cat /sys/class/net/<iface>/carrier

0

 

See also the following:

https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

808 次查看
jungong
Contributor II

Thank you very much.

 

I have tried as following:

I tried "ifconfig" ,but always log running both plug into and plug out the network cable!

I tried "cat /sys/class/net/carrier" ,the log is no change when plug into and plug out the network cable!

I tested use ioctl(fd,SIOCGIFFLAGS,&ifreq) , it 's right only exec command "ifconfig eth0 down /up", but always "RUNNING" both plug into/out the network cable!

I checked  my board's schematic diagram, maybe reason is  not connect INT pin of phy to IRQ pin of p1010 ?

0 项奖励
回复