Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Detecting new "enX" device: (3 Items)
   
Detecting new "enX" device  
Hi,

I am porting a Linux app across to QNX that used UDEV to determine when an ethernet device had been created. (In this 
case, when plugging in a USB ethernet device.)

QNX doesn't have an equivalent (At least I can't find one), so what is the best way to achieve this?

Something similar to "mcd" that can detect en* would be useful, but I don't think mcd can do this.

My other thoughts are that I could have the driver send a message to another process to tell it that a device had been 
added.

Or is there a way to have a thread poll and somehow detect that an enX device has been created by polling? (Polling what
?)

I'm totally new to QNX, so be gentle...
Re: Detecting new "enX" device  
Hi and welcome to using QNX :-)

QNX networking is more like NetBSD than Linux so you can draw on NetBSD 
experience if you have. I'm actually not sure how udev does what you're 
referring to on Linux so please excuse if I'm misunderstanding. One 
method to learn when interfaces are added is the routing socket. 
Utilities which use it include e.g. 'route monitor' and 'ifwatchd'. 
Please see the utilities references:

http://www.qnx.com/developers/docs/6.4.1/neutrino/utilities/i/ifwatchd.html

PS. I'm assuming you're using io-pkt not io-net?

Cheers!
/P

On 10-07-14 10:16 AM, Martin Nike wrote:
> Hi,
>
> I am porting a Linux app across to QNX that used UDEV to determine when an ethernet device had been created. (In this 
case, when plugging in a USB ethernet device.)
>
> QNX doesn't have an equivalent (At least I can't find one), so what is the best way to achieve this?
>
> Something similar to "mcd" that can detect en* would be useful, but I don't think mcd can do this.
>
> My other thoughts are that I could have the driver send a message to another process to tell it that a device had been
 added.
>
> Or is there a way to have a thread poll and somehow detect that an enX device has been created by polling? (Polling 
what?)
>
> I'm totally new to QNX, so be gentle...
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post59412
>
Re: Detecting new "enX" device  
> Hi and welcome to using QNX :-)
> 
> QNX networking is more like NetBSD than Linux so you can draw on NetBSD 
> experience if you have. I'm actually not sure how udev does what you're 
> referring to on Linux so please excuse if I'm misunderstanding. One 
> method to learn when interfaces are added is the routing socket. 
> Utilities which use it include e.g. 'route monitor' and 'ifwatchd'. 
> Please see the utilities references:
> 
> http://www.qnx.com/developers/docs/6.4.1/neutrino/utilities/i/ifwatchd.html
> 
> PS. I'm assuming you're using io-pkt not io-net?
> 

Hi, thanks for your reply! I'll investigate those tools.

"Udev" in Linux is a device manager - when the kernel creates a device, it sends a lot of information to "udev" via a 
socket about the device. You can write a script that looks for matches.

EG execute an app when "eth0" is added, from vendor V, product P...

When a USB ethernet device is plugged in, the kernel sends the device name to UDEV and you can have a script that 
triggers some application (Such as a dhcp client.). 

I'd say UDEV is a _bit_ like MCD, except its usage extend way beyond mounting devices.

In my case, I need to know when a new "enX" is created, plus information about the USB device.

Thanks again.