how can I search for the name of an ethernet interface?
background:
I have to use an ethernet connection to get my windows mobile device through usb connected.
this works fine. but there are many mobile devices I have to manage and every single device gets an own ethernet interface.
therefore i need a way to search for the name which is automaticly assigned in yast2. in the network settings in yast 2 the name of the devices is always the manufacture.
What I wanna do is to check which interfaces has this manufacture name (must be done with script in the background) to configure this interface with ifconfig.
but ifconfig doesn’t show me the name.
I’m not sure that I completely understand your requirements, but hwinfo might be helpful here. It can be used to help identify the the device manufacturer (model, vendor, device) and any device node associated
thank for the fast response.
With hwinfo I can get the manufacture. That’s true. But it doesn’t shows me all interface. Just the current up interfaces.
the network manager shows me that interface eth1 is created. But currently there is no device connected.
what I wanna do is do clear all none used ethx inferfaces afer some time. because there are many usb devices that can be connected to suse. afer some time it could be that there were more than 100 devices conneted. Then I would have eth1-100.
Therefore I need a way to check if the interface is one of “my usb devices”. The only way I see is to get the name of the interface which is shown in the yas2 network information because this is the manufacture of the mobile device.
Or I check if the interface is up and if not I delete it. But of course this would be a problem if someone disconnect the ethernet cable :).
ok, the “Name” set in /etc/sysconfig/network/ifcfg-ethx
the question is:
how can I read the name out of them and delete the interface?
Woult it be enough if I just delete the file?
In the GUI it’s really easy because you just have to click delete :).
therefore I think it should be possible to handle that whith a script without restarting the network deamon.
would you write a script that runs in a loop to check the interfaces or would you write a deamon for that?
I’ve found a way to read the name out of ifcfg-ethx.
just doing a loop on all files ifcfg-eth* and checking the variable $NAME with “source”.
Now I know how many devices were connected.
Deleting the ifcfg-ethx file will also clean the devices out of the network manager. that’s fine.
the only thing I have to do after connecting a new device is, open the yast 2 network configuration utility - which shows me the new network adapter but not configured.
I have to asign dhcp and the “configuration name” eth1.
After doing this the device works like a charm.
I was able to script this to by creating the correct configuration file in /etc/sysconfig/network and start the interface.
What I need now is a way to interact with the kernel buffer or the usb event.
in dmesg i can see the the usb device was mounted.
To auto configure my interface I would like to run my script.
But therfore I need a way to get the usb event or another way to run my script if a usb device is pluged in.
What I need now is a way to interact with the kernel buffer or the usb event.
in dmesg i can see the the usb device was mounted.
To auto configure my interface I would like to run my script.
But therfore I need a way to get the usb event or another way to run my script if a usb device is pluged in.
You could create a udev rule for this, so that a script is run or a variable set perhaps.
A lot of times it’s useful to describe your entire project so that people understand what you want to accomplish and might even be able to suggest an overall strategy instead of the piecemeal requests you’re making. When you describe your project, it’s important to format your description for easy reading, you’ll find examples all over the Internet but your description might look something like the following…
Brief Description
Detailed Description
Primary objective
Secondary objectives (ie either optional or required to attain Primary objective)
The Detailed Description might include your existing hardware and/or software, the circumstances, some reasoning, etc.
Some info re what has been covered in this thread…
You can create and edit your interface files as you wish, you don’t need to use YAST.
Typically when you’re editing the interface files directly, I’ve used ifup/ifdown to activate or de-activate the interface
You may want to investigate any existing solutions for managing multiple Windows devices, if they exist you may be able to avoid re-inventing the wheel. Even if an app exists only for Windows Hosts, it can be reverse-engineered.
It might be useful to know why you’re creating this solution, typically network interface names are not required for identification, the sync and connect management applications I’ve seen in the past use the device name to further manage the device. This avoids the fact that every time you connect a mobile device in a different order, it’s likely going to use a different or shared network connection.