Announcement

Collapse
No announcement yet.

How to set up a feeder on Windows 10/11 using Windows Subsystem for Linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • abcd567
    replied
    Great! Well done bimmerdriver

    Thumb-31x34.jpgThumb-31x34.jpgThumb-31x34.jpg

    Leave a comment:


  • bimmerdriver
    replied
    I've been working on a systemd service to automatically attach the receiver after booting, before dump1090-fa is started, to prevent failed startup.

    I finally have something that's ready to release. The code is below. Even if you're not familiar with systemd, it's fairly self-explanatory how it works.

    The service, called usbipd-win is started by systemd after the network is online and before dump1090-fa starts.

    To install it, follow the instructions in the comments.

    Code:
    # USBIPD-WIN Service for Ubuntu 22.04 systemd
    # Attach USB SDR after the network is online and before dump1090-fa starts
    # Requires github.com/dorssel/usbipd-win to be installed on WSL host
    #
    # Installation Instructions
    #
    # NOTE: Replace <VID:PID> with actual VID:PID
    #
    # In Windows Administrator Command Prompt:
    # usbipd list
    # usbipd bind --hardware-id VID:PID
    #
    # In WSL Bash shell:
    # sudo cp ./usbipd-win.service /etc/systemd/system
    # sudo systemctl daemon-reload
    # sudo systemctl enable usbipd-win
    #
    # After installation, use the following commands to start, stop, restart or status
    # sudo systemctl start usbipd-win
    # sudo systemctl stop usbipd-win
    # sudo systemctl restart usbipd-win
    # sudo systemctl status usbipd-win
    #
    # NOTE: If after executing systemctl stop usbipd-win or systemctl restart usbipd-win, the
    # Bash window is defocussed, click the mouse in the window to bring it back into focus.​
    
    [Unit]
    Description=USBIPD-WIN Attach USB SDR before dump1090-fa starts
    Wants=network-online.target
    After=network-online.target
    Before=dump1090-fa.service
    
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=bash -c "/mnt/c/'Program Files'/usbipd-win//usbipd.exe attach --wsl --hardware-id VID:PID"
    ExecStop=bash -c "/mnt/c/'Program Files'/usbipd-win//usbipd.exe detach --hardware-id VID:PID; sleep 1"
    
    [Install]
    WantedBy=default.target​
    While I was testing this service, I looked at how other related services are being started. I noticed that piaware was configured to start after dump1090-fa, but fr24feed was not. I also noticed that fr24feed has the obnoxious behaviour of trying to install dump1090. I wasn't happy with either of these issues, so I fixed them.

    Below is revised code for fr24feed. The changes are commented. It installs the same way as usbipd-win.

    Code:
    [Unit]
    Description=Flightradar24 Decoder & Feeder
    After=network-online.target
    
    # The following lines have been added to cause this service to have the same
    # prerequisites and start order as piaware.service.
    Wants=network-online.target
    After=dump1090-fa.service time-sync.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    # The following line has been commented out because it's not
    # best practice to install a service from inside a service.#
    #ExecStartPre=-/usr/lib/fr24/install_dump1090.sh
    ExecStartPre=-/usr/lib/fr24/unregister_kernel_modules.sh
    ExecStartPre=-/usr/lib/fr24/create_missing_directories.sh
    ExecStartPre=/usr/bin/fr24feed --validate-config --config-file=/etc/fr24feed.ini
    ExecStart=/usr/bin/fr24feed
    User=fr24
    Group=fr24
    PermissionsStartOnly=true
    StandardOutput=journal
    StandardError=journal
    
    [Install]
    WantedBy=multi-user.target​
    If you install these services, usbipd-win will start first, then dump1090-fa, then finally fr24feed and piaware will start at the same time.

    Special thanks to abcd567 for testing.

    Leave a comment:


  • abcd567
    replied
    @kkomarica
    Good news. I will now change my settings from avr-tcp 30002 to beast-tcp 30005 and see how mlat behaves

    Leave a comment:


  • kkomarica
    replied
    abcd567 just to get back to you. one week after, mlat is still running. I'm going to stick with this settings for now.

    Leave a comment:


  • abcd567
    replied

    @kkomarica

    Check fr24feed-status after few days, and you will find mlat not running.

    The small whip antenna supplied with dvbt is just a starter. You cannot get very good performance from it. To get very good performance you will meed a commercial antenna and a dongle with builtin amplifier+filter. If you have strong RF interference from nesrby mobile/cell phone tower or tv tower, then you will need to add an external filter also.

    Leave a comment:


  • kkomarica
    replied
    I made some changes to my setup so that I managed to get MLAT running. Using advice in some old post by abcd567 I switched to beast-tcp and port 30005 ... thanks!

    Code:
    sudo fr24feed-status
     * FR24 Feeder/Decoder Process: running
     * FR24 Stats Timestamp: 2024-03-24 16:33:04
     * FR24 Link: connected [UDP]
     * FR24 Radar: T-LDZA47
     * FR24 Tracked AC: 29
     * Receiver: connected (742187 MSGS/15 SYNC)
     * FR24 MLAT: ok [UDP]
     * FR24 MLAT AC seen: 28​

    Another thing that I wanted to ask (and I am doing it here, not to start a new thread) ...
    is the very good performance for ADS-B reception of the default china dvb-t antenna known and reported already?

    I am talking about the small magnetic antenna (mcx connector) that you get with most of the cheapest dvb-t sdr sticks:

    Hd8028d4eb3b74a988bec8d4539738b70t.jpg?width=898&amp;height=898&amp;hash=1796.webp
    Last edited by kkomarica; 2024-03-24, 19:56.

    Leave a comment:


  • bimmerdriver
    replied
    Originally posted by abcd567 View Post
    @kkomarica

    FR24 has said that:

    (1) MLAT is allowed only if in fr24feed settings, you select "receiver =dvbt". This means dump1090-mutability will be installed, and you will have to remove dup1090-fa or readsb if you have it already installed.

    (2) If you are feeding other sites as well from your receiver, then you should disable mlat in fr24feed settings.
    I'm feeding to flightradar24 and flightaware. FA is using my receiver for MLAT, but not FR24.

    UPDATE: Further to what abcd567 said, I do not have MLAT enabled in the fr24feed settings.
    Last edited by bimmerdriver; 2024-03-24, 17:10.

    Leave a comment:


  • bimmerdriver
    replied
    Originally posted by abcd567 View Post

    This will be great. Waiting for you to get it working and share

    I have created a batch file "Start-WSL.bat" and saved it on Desktop.
    When I want to start wsl, I right-click it and choose "run as administrator"
    This batch file not only starts wsl, but also attaches the DVB-T Dongle to wsl.

    The contents of this batch file are as follows:

    Code:
    wsl
    powershell -Command "& {usbipd bind --hardware-id 0bda:2838; usbipd attach --wsl --hardware-id 0bda:2838}"


    LATER EDIT (March 23, 2024):
    I found that the comands given above for the batch file do NOT work reliably. Sometimes the DVB-T will be attached, and sometime NOT attached. I have now completely changed the code and it seems to work reliably. The revised code for batch file "Start-WSL.bat" is given below:

    Code:
    start wsl
    timeout 2
    usbipd bind --hardware-id 0bda:2838
    usbipd attach --wsl --hardware-id 0bda:2838
    exit​

    Please note that if you want to log the stderr & stdout when batch file is run, then use following code in the batch file. You have to give log file's location. I have used C:\Users\abcd\Documents\wsl-log.txt

    Code:
    start wsl
    timeout 2
    usbipd bind --hardware-id 0bda:2838 > C:\Users\abcd\Documents\wsl-log.txt 2>&1
    usbipd attach --wsl --hardware-id 0bda:2838 >> C:\Users\abcd\Documents\wsl-log.txt 2>&1
    exit​


    The contents of log file are as follows:

    Code:
    usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
    usbipd: info: Device with busid '1-14' was already shared.
    usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
    usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
    usbipd: info: Using IP address 172.19.80.1 to reach the host.
    
    ​


    The cmd window opened by running the batch file as administrator


    wsl-started-by-batch-file.png
    Unless you change the port the USB SDR is plugged into, you only need to bind it once. Once you bind it, it stays binded, even if you remove and reinsert it. Also, the bind command requires administrator rights. You can execute a command on windows from inside WSL2, but I don't recall if there is a way to execute a command requiring administrator rights.

    The problem of using usbipd-win is that WSL2 must be booted and the network must be running in order to attach a USB device. This requires the network-online.target to have been reached by systemd. As soon as this target has been reached, systemd starts other services, including dump1090-XX, which require the USB to be attached, so the window of opportunity to execut the attach command is very short.

    I'm working on a service that starts after network-online.target and completes before dump1090-fa starts. My intention is for the service to support start (attach), stop (detach) and restart (detach, attach). I'm testing it and I will post the files as soon as possible. This service will require manual installation and manual configuration.

    This has taken a while because I'm busy, when I started, I didn't know anything about systemd and the last shell script I wrote was a tcsh script on a Digital AlphaStation running Digital UNIX. Now I know enough about systemd to be dangerous.

    I noticed you used hardware-id. I used busid. I just did a test and verified that hardware-id doesn't change, even if you change the port. That's better than busid, so I will put it on the to-do list to change to hardware-id.

    There doesn't seem to be a version of linux-tools for the version of linux being used by WSL2, so I'm executing the usbipd commands on Windows from inside WSL2.

    More later...

    Leave a comment:


  • abcd567
    replied
    @kkomarica

    FR24 has said that:

    (1) MLAT is allowed only if in fr24feed settings, you select "receiver =dvbt". This means dump1090-mutability will be installed, and you will have to remove dup1090-fa or readsb if you have it already installed.

    (2) If you are feeding other sites as well from your receiver, then you should disable mlat in fr24feed settings.

    Leave a comment:


  • kkomarica
    replied
    Originally posted by kkomarica View Post
    I have tried everything that it's written here, but no luck. The issue remains.
    I have made several reinstalls following all the instructions.
    Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
    I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​

    Just to report back after a few days ... everything is running without problems.
    The only thing that I don't know how to setup is MLAT ... it just says "not running"
    I have read posts here that one should not be concerned about MLAT in FR24, but I would really like to locate some local traffic (helicopters and small planes).
    My geographical position is on the other side of the hill from the majority of other receivers and I believe that I could help in MLAT calculations.

    Leave a comment:


  • abcd567
    replied
    Originally posted by bimmerdriver View Post

    FYI, I started working on a systemd service to attach the USB SDR at boot, before dump1090-fa starts. When I get it working, I'll share it here.
    This will be great. Waiting for you to get it working and share

    I have created a batch file "Start-WSL.bat" and saved it on Desktop.
    When I want to start wsl, I right-click it and choose "run as administrator"
    This batch file not only starts wsl, but also attaches the DVB-T Dongle to wsl.

    The contents of this batch file are as follows:

    Code:
    wsl
    powershell -Command "& {usbipd bind --hardware-id 0bda:2838; usbipd attach --wsl --hardware-id 0bda:2838}"


    LATER EDIT (March 23, 2024):
    I found that the comands given above for the batch file do NOT work reliably. Sometimes the DVB-T will be attached, and sometime NOT attached. I have now completely changed the code and it seems to work reliably. The revised code for batch file "Start-WSL.bat" is given below:

    Code:
    start wsl
    timeout 2
    usbipd bind --hardware-id 0bda:2838
    usbipd attach --wsl --hardware-id 0bda:2838
    exit​

    Please note that if you want to log the stderr & stdout when batch file is run, then use following code in the batch file. You have to give log file's location. I have used C:\Users\abcd\Documents\wsl-log.txt

    Code:
    start wsl
    timeout 2
    usbipd bind --hardware-id 0bda:2838 > C:\Users\abcd\Documents\wsl-log.txt 2>&1
    usbipd attach --wsl --hardware-id 0bda:2838 >> C:\Users\abcd\Documents\wsl-log.txt 2>&1
    exit​


    The contents of log file are as follows:

    Code:
    usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
    usbipd: info: Device with busid '1-14' was already shared.
    usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
    usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
    usbipd: info: Using IP address 172.19.80.1 to reach the host.
    
    ​


    The cmd window opened by running the batch file as administrator


    wsl-started-by-batch-file.png
    Last edited by abcd567; 2024-03-23, 20:28.

    Leave a comment:


  • bimmerdriver
    replied
    Originally posted by kkomarica View Post
    Like Borat would said: GREAT SUCCESS!
    Feeder is up an running, using WSL2 .
    Big thanks bimmerdriver for all the help!


    It seems that in the older version of windows I could not update the WSL kernel to the level needed to support systemd.
    After windows update, I could update WSL to the latest version and know it's working.

    How can I accesses the dump-fa status/map when using wsl ... how can I see the IP address of the wsl virtual machine?
    That's great news! I'm glad to hear you got it working.

    If you want to know the ip address of the WSL VM, the command is:

    CODE]wsl hostname -I[/CODE]

    You can access the dump1090-fa map using

    <ip>/skyaware/
    <ip>:8754

    You can also use 127.0.0.1 or localhost, rather than the actual address.

    FYI, I started working on a systemd service to attach the USB SDR at boot, before dump1090-fa starts. When I get it working, I'll share it here.

    I'm also wrestling with fr42feed messing with the system clock. I might try setting up a local ntpd on the VM. Again, I'll post about that if it helps.

    Leave a comment:


  • kkomarica
    replied
    Like Borat would said: GREAT SUCCESS!
    Feeder is up an running, using WSL2 .
    Big thanks bimmerdriver for all the help!


    It seems that in the older version of windows I could not update the WSL kernel to the level needed to support systemd.
    After windows update, I could update WSL to the latest version and now it's working.

    How can I accesses the dump-fa status/map when using wsl ... how can I see the IP address of the wsl virtual machine?
    Last edited by kkomarica; 2024-03-23, 09:25.

    Leave a comment:


  • bimmerdriver
    replied
    Originally posted by kkomarica View Post
    I have tried everything that it's written here, but no luck. The issue remains.
    I have made several reinstalls following all the instructions.
    Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
    I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​
    That's really strange. If you're running 21H2, it should be sufficient. I'm using 22H2 build 19045.4170.

    Please confirm you installed wsl using wsl --install and not using the control panel.

    Please run the following commands and post the output:

    wsl -- version
    wsl --list --verbose

    Please show the contents of /etc/wsl.conf.

    Leave a comment:


  • kkomarica
    replied
    I have tried everything that it's written here, but no luck. The issue remains.
    I have made several reinstalls following all the instructions.
    Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
    I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​

    Leave a comment:

Working...
X