home.social

#devd โ€” Public Fediverse posts

Live and recent posts from across the Fediverse tagged #devd, aggregated by home.social.

  1. So, after I met problems with iwlwifi driver and my attempts to aggregate both em0 and wlan0 interfaces to the one lagg0 interface (mastodon.bsd.cafe/@evgandr/115) โ€” looks like I found a much (MUCH!) simpler solution :drgn_happy:

    I wanted to automatically switch between wired and wireless networks when I plug-in (or disconnect) my Ethernet cable. First, because I was a newbie in the FreeBSD world, I tried to search for some kind of NetworkManager. Thankfully, I didn't find any NetworkManager clone ported to the FreeBSD. I found some tries to port NetworkManager from Linux to FreeBSD but all of them are failed (not surprised, lol).

    Then, I finally started to read documentation :drgn_think_science: . In the section about advanced networking I read about aggregation interfaces. And somehow I managed to aggregate both of em0 and wlan0 to the one lagg0 interface and it works well.

    But, looks like (see mstdn.social/@erikarn/11598626) it is not the way how the lagg interfaces should work. It is not intended to use wireless interfaces in the aggregate interfaces โ€” so my tricky setup stopped working in the FreeBSD 15.0.

    BUT, since we have a beautiful devd daemon, which listens for various system events and able to execute actions when event is happened โ€” I just wrote 23 lines of shell script to learn my laptop how to switch between interfaces when the Ethernet cable (dis)connects, lol. Solution is very simple:

    First, we already have /etc/devd/dhclient.conf, which starts dhclient when some interface appeared in the system. I modified it, so it calls the sPeCiAL script, each time when em0, or wlan0, or ue0 interface appeared in the system, or when em0 is disappeared:

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_UP";
    media-type "ethernet";
    action "/root/bin/unfuck_network.tcsh $subsystem ifup";
    };

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_DOWN";
    media-type "ethernet";
    action "/root/bin/unfuck_network.tcsh $subsystem ifdown";
    };

    notify 0 {
    match "system" "IFNET";
    match "type" "LINK_UP";
    media-type "802.11";
    action "/root/bin/unfuck_network.tcsh $subsystem";
    };

    notify 0 {
    match "system" "ETHERNET";
    match "type" "IFATTACH";
    match "subsystem" "ue0";
    action "/root/bin/unfuck_network.tcsh ue0";
    };

    Then, the main magic happens in the /root/bin/unfuck_network.tcsh:
    โ€” When Ethernet cable is connected โ€” it destroys the wlan0 interface and starts dhclient for em0 to talk with DHCP server.
    โ€” When Ethernet cable is disconnected โ€” it makes all to remove route using em0 from routing table (removes em0 interface completely, flush routing table, etc โ€” somehow em0 still stays in the routing table if interface is not destroyed; btw system will create it anyway later, in some point) and recreates the wlan0 interface.
    โ€” When wlan0 device is created โ€” it starts dhclient for it.

    Script contents (for tcsh):
    #!/bin/tcsh

    switch ( $1 )
    case "em0":
    if ( $2 == "ifup" ) then
    service netif quietstop wlan0
    service dhclient quietstart em0
    else if ( $2 == "ifdown" ) then
    service dhclient quietstop em0
    ifconfig em0 delete
    route flush
    service routing restart
    service netif quietstart wlan0
    endif
    breaksw;
    case "wlan0":
    service dhclient quietstart wlan0
    breaksw;
    case "ue0":
    service dhclient quietstart ue0
    breaksw;
    endsw

    #FreeBSD #FreeBSD150RELEASE #wifi #tcsh #devd #iwm

  2. I finally managed to migrate over to #SDDM in #FreeBSD.

    It turns out I was missing pam_xdg package. LightDM would not allow me to switch tty after logging in. SDDM is fine with it though :)

    I also learned about devd and configured it for laptop lid close event. It was easier than I thought.

    I need to setup auto switching to headphones. Manually changing it via pavucontrol is terrible.

    btw I am looking for wifi & BT GUI to setup stuff when needed.

    #FreeBSD14 #diary #freebsd #devd

  3. New ๐—”๐˜‚๐—ฑ๐—ถ๐—ผ ๐—œ๐—บ๐—ฝ๐—ฟ๐—ผ๐˜ƒ๐—ฒ๐—บ๐—ฒ๐—ป๐˜๐˜€ (Audio Improvements) article on the vermaden.wordpress.com/ blog.

    vermaden.wordpress.com/2024/01

    #verblog #freebsd #desktop #laptop #audio #sound #devd #openbox #oss #pulseaudio

  4. #devd on #freebsd is so useful. Just wrote two quick rule to change to a audio device if plug it in.

  5. Added ๐—จ๐—ฃ๐——๐—”๐—ง๐—˜ ๐Ÿญ - ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—ฑ๐—ฒ๐˜ƒ๐—ฑ ๐—ฆ๐—ป๐—ถ๐—ณ๐—ณ๐—ถ๐—ป๐—ด - ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—จ๐—ป๐—น๐—ผ๐—ฐ๐—ธ ๐— ๐—ฒ๐˜๐—ต๐—ผ๐—ฑ to the ๐—™๐—ฟ๐—ฒ๐—ฒ๐—•๐—ฆ๐—— ๐——๐—ฒ๐˜€๐—ธ๐˜๐—ผ๐—ฝ - ๐—ฃ๐—ฎ๐—ฟ๐˜ ๐Ÿฎ๐Ÿฌ - ๐—–๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป - ๐—จ๐—ป๐—น๐—ผ๐—ฐ๐—ธ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—Ÿ๐—ฎ๐—ฝ๐˜๐—ผ๐—ฝ ๐˜„๐—ถ๐˜๐—ต ๐—ฃ๐—ต๐—ผ๐—ป๐—ฒ article.

    vermaden.wordpress.com/2020/01

    #verblog #freebsd #desktop #laptop #lock #unlock #devd

  6. The latest ๐˜€๐˜†๐˜€๐˜‚๐˜๐—ถ๐—น๐˜€/๐—ฎ๐˜‚๐˜๐—ผ๐—บ๐—ผ๐˜‚๐—ป๐˜ version 1.7.1 just landed in #FreeBSD Ports:
    svnweb.freebsd.org/ports?view=

    #verblog #automount #devd

    Complete guide if needed:
    vermaden.wordpress.com/2018/10