/etc/pccard_ether && assigning IP and routing

Shane Ambler FreeBSD at ShaneWare.Biz
Thu Jun 18 12:47:20 UTC 2015


On 18/06/2015 15:35, Matthias Apitz wrote:
>
> Hello,
>
> I own an Ubuntu phone BQ E4.5 and when I attach this on USB to my
> FreeBSD netbook the devd(8) launches
>
> /etc/pccard_ether ue0 start
>
> which works fine and the interface ue0 comes UP. I'd like to run an
> additional script to assign IP via dhcclient, establish a default
> route and restart sendmail. I do this manually as root with a script:
>
>
> #!/bin/sh
> #
> # change routing (...) to the Ubuntu phone BQ Aqaris E4.5
> #
>
> ifconfig ue0 || {
>      printf "interface ue0 not found -- exit.\n"
>      exit 1
> }
>
> ifconfig wlan0 down
> route delete default
>
> killall dhclient
> rm -f /etc/resolv.conf
> dhclient ue0
>
> /etc/rc.d/sendmail stop
> sleep 3
> /etc/rc.d/sendmail start
>
> I found no way with devd(8) hooks to run this script when interface ue0
> comes up. Any ideas? Thanks in advance.
>
> 	matthias
>

usbconfig will list devices, if your phone is at ugen2.5 then -
usbconfig -u 2 -a 5 dump_device_desc | grep idVendor

Replace your idvendor in the following -

Put the following into /usr/local/etc/devd/myubuntuphone.conf

attach 200 {
	device-name "ue[0-9]+";
	match "vendor" "0x056a";
	action "/path/to/script options";
};

detach 200 {
	device-name "ue[0-9]+";
	match "vendor" "0x056a";
	action "/path/to/script options";
};



-- 
FreeBSD - the place to B...Software Developing

Shane Ambler



More information about the freebsd-questions mailing list