Monitoring gadget events or g_ether events to run custom ifup script

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Monitoring gadget events or g_ether events to run custom ifup script

971 Views
kevin_chaves
Contributor III

I'm trying to find where in linux i would be able to setup the network interface for g_ether. Basically I want to run avahi-autoipd and dhcpd on the usb0 interface when it comes up. The problem is that linux isn't as transparent about how all this things are supposed to work. I worked with wince previously and what I want to do was really simple registry options...

So in my /etc/network/interfaces I have set usb0 as manual with custom scripts for up/down.

allow-howplug usb0

iface usb0 inet manual

     up /path/to/script

     down /path/to/script

When I plug in my device to a host pc, neither is run. I guess i don't really understand how g_ether acts as a network interface since it doesn't seem to know its available, and doesn't run ifup for it. If i run ifup usb0 the scripts will run.

I'm thinking i can create a udev rule, when the usb is plugged in, to run ifup usb0 and ifdown usb0 depending on the state.

Any help would be much appreciated.

Labels (2)
Tags (3)
0 Kudos
2 Replies

666 Views
kevin_chaves
Contributor III

There might be an issue with our otg driver, or board... I'm not sure.

It seems regardless of whether or not I've plugged the usb in, the device is always down. That might be why allow-hotplug doesn't work?

# cat carrier

cat: read error: Invalid argument

# cat operstate

down

0 Kudos

666 Views
jamesbone
NXP TechSupport
NXP TechSupport

Hello Kevin,

What board are you using?, because  I have seen in the schematics of the i.MX6Solo EVK that the USB OTG share pins with the USB  Host so you always begin with the device down, to avoid a hardware issue. If this is the case we can test in a WandBoard. to see if the problem persist.


Have a great day,
Jaime

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

0 Kudos