Jump to content

digitalsuper8

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by digitalsuper8

  1. On 27-10-2017 at 10:28 AM, JohnF said:

    I had the same issue with wiringNP on nanoPi NEO. The issue was resolved by adding a line to the file "boardtype_friendlyelec.c" in the array "BoardHardwareInfo gAllBoardHardwareInfo[]"

     

    The line added is:

    {"sun8i", 0, NanoPi_NEO, "NanoPi-NEO-Armbian", "-1(-1)"},

     

    The critical parameter is the -1(-1), which is the board type reported by the kernel for this board.

     

    I have not carried our thorough testing, but the gpio readall reports properly and I am able to toggle outputs and read inputs correctly using the gpio command.

    I will try this on the Neo Air 

  2. I believe it has to do with the Armbian Kernel where there may be no model name specified? Like H3 or something? The file /proc/cpuinfo, which is a virtual file and I believe its contents are determined by what is in the kernel, doesn't give any model name and gpio is looking for a model name.

    So gpio readall fails:

     

    $ gpio -v readall

     

    gives:


    gpio version: 2.20
    Copyright (c) 2012-2014 Gordon Henderson
    This is free software with ABSOLUTELY NO WARRANTY.
    For details type: gpio -warranty

    Your NanoPi has an unknown model type. Please report this to
        support@friendlyarm.com
    with a copy of your /proc/cpuinfo if possible

     

  3. So here's a more detailed explanation for getting the Nanopi Neo Air to act as wifi accesspoint after boot.

    I used the FergusL scripts for inspiration and for understanding the contents of the various conf files needed.

     

    So after disabling hostapd and dnsmasq I wrote the following bash script, in the directory /usr/local/bin/. It's called neoaccesspoint.

     

    sudo nano /usr/local/bin/neoaccesspoint

     

    #!/bin/bash
    PATH="$PATH:/usr/bin/"
    
    case "$1" in
    start)
    # Assumption: NetworkManager systemd service is stopped and disabled
    # Assumption: dnsmasq is disabled from startup
    # Assumption: hostapd is disabled from startup
    
    # We first have to bring wlan0 down
    echo "Bringing wlan0 down"
    ifdown wlan0
    
    # Then remove the dhd module and load it again in operating mode 2
    echo "removing module dhd and doing modprobe dhd op_mode2"
    rmmod dhd
    modprobe dhd op_mode=2
    
    # we then have to bring wlan0 up again for it to get an IP address
    echo "bringing wlan0 up again"
    ifup wlan0
    
    # We then bring up hostapd
    echo "starting hostapd"
    /bin/systemctl start hostapd
    
    # And we start dnsmasq
    echo "starting dnsmasq"
    #/usr/sbin/dnsmasq
    /bin/systemctl start dnsmasq
    ;;
    
    stop)
    # type any commmand
    echo "Stopping MyAP_Startup service: stopping dnsmasq and hostapd and bringing down wlan0"
    /bin/systemctl stop hostapd
    /bin/systemctl stop dnsmasq
    ifdown wlan0
    ;;
    
    restart)
    $0 stop
    $0 start
    ;;
    esac
    exit 0

    Then I created a service file in /lib/systemd/system/

    sudo nano /lib/systemd/system/neoairaccesspoint.service

     

    the contents:

    [Unit]
    #This file has to be in /etc/systemd/system/
    Description=Manage the neoairaccesspoint script
    
    # Example After statement, this unit only starts after the speficied units are active
    #After=syslog.target network.target
    
    [Service]
    #Type=forking
    Type=oneshot
    ExecStart=/usr/local/bin/neoairaccesspoint start
    RemainAfterExit=true
    ExecStop=/usr/local/bin/neoairaccesspoint stop
    ExecReload=/usr/local/bin/neoairaccesspoint restart
    
    # We probably don't want to specify the user here
    #User=npi
    
    [Install]
    WantedBy=graphical.target

    I enabled this service by the following commands:

     

    sudo systemctl daemon-reload

    sudo systemctl enable neoairaccesspoint.service

     

    This should do it after reboot:

     

    sudo systemctl reboot

     

    Hope it works for you. Of course you have to have your conf files correct for:

     

    hostapd.conf

    dnsmasq.conf

    and

    /etc/network/interfaces

     

     

  4. I have a NanoPi Neo Air now working as wifi accesspoint, showing SSID and allowing me to connect. My first trials with the apmode.sh (thanks FergusL) gave me the same problem that most of you had: There was an SSID being broadcast but I simply couldn't connect. In my case I believe the problem was doing:

    rmmod dhd
    modprobe dhd op_mode=2
    

    Because this brought down the wlan0 module and I found out that thereafter the wlan0 doesn't have an IP address anymore. This causes problems for dnsmasq and leads to dnsmasq not issueing ip-addresses to devices that connect to hostapd. So hostapd accepts the password but dnsmasq doesn't provide an IP address so you cannot connect..

     

    So here's what I did:

    1. I disabled NetworkManager once (that then makes that permanently disabled at boot up):

    /bin/systemctl stop NetworkManager
    /bin/systemctl disable NetworkManager

    2. Because Armbian in my case started up hostapd and dnsmasq during boot I disabled those too.

    /bin/systemctl disable hostapd
    /bin/systemctl disable dnsmasq

    3. I wrote a script that first brings down wlan0 (ifdown wlan0), then runs the ' rmmod dhd' and 'modprobe dhd op_mode=2' commands. After that it brings up wlan0 (ifup wlan0), so that it again gets an IP address (it uses the 'interfaces'  file for that). Finally the script starts hostapd and dnsmasq:

    ifdown wlan0
    rmmod dhd
    modprobe dhd op_mode=2
    ifup wlan0
    
    /bin/systemctl start hostapd
    /bin/systemctl start dnsmasq

     

    I created a service based on that script and enabled it with systemctl so that at each boot automatically the nanopi neo air is in wifi accesspoint mode and will broadcast SSID and allows connections.

    I need to look up the exact script and the service files and will post those. It worked for my set up, hope it helps.

     

    image.png

    image.png

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines