Network Manager in debian stretch

4. Oktober 2017

nmtui
root@NanoPi-Duo:/sys/class/leds# nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 e459c727-dfdd-3108-9328-20c58f0b1fd5 802-3-ethernet eth0

nmcli connection modify ‚Wired connection 1‘ connection.autoconnect yes ipv4.method manual ipv4.address 192.168.6.113/24 ipv4.gateway 192.168.6.1 ipv4.dns 192.168.6.3

Setup Static IP Manually
You can setup a static IP manually without using the NetworkManager:

sudo vi /etc/NetworkManager/NetworkManager.conf
Edit NetworkManger.conf and set the value of „managed“ under „ifupdown“ to false:

[ifupdown]
managed=false
Add network setting to /etc/network/interfaces:

$ sudo vi /etc/network/interfaces

http://wiki.friendlyarm.com/wiki/index.php/NanoPi_Duo
http://wiki.friendlyarm.com/wiki/index.php/Use_NetworkManager_to_configure_network_settings

Advertisements

USB-GPS via Commandline

4. Oktober 2017

$ su – (or sudo -s )
# killall -9 gpsd ntpd
# gpsd -n /dev/ttyXX
# sleep 2
# ntpd -gN
# sleep 2
# cgps

root@PiHole:~# killall -9 gpsd ntpd
root@PiHole:~# /usr/sbin/gpsd -D 5 -n /dev/ttyACM0 -F /var/run/gpsd.sock
root@PiHole:~# ntpd -gN
root@PiHole:~# cgps -s
root@PiHole:~# ntpq -p
remote refid st t when poll reach delay offset jitter

-yoda.dousse.eu 149.202.97.123 3 u 44 64 1 210.131 -86.548 3.725
+metronoom.dmz.c .PPS. 1 u 44 64 1 195.995 -76.241 9.432
*time.ume.tubita .PPS. 1 u 43 64 1 22.269 -12.244 0.827
+213.251.52.185 193.0.0.229 2 u 42 64 1 49.814 4.573 0.895
SHM(0) .GPS. 0 l 3 16 3 0.000 -118.66 5.580
SHM(1) .PPS. 0 l – 16 0 0.000 0.000 0.000

 

apt-get install gpsd gpsd-clients
apt-get install ntpstat
apt-get install openntpd
/usr/sbin/gpsd -D 5 -S 1024 -n /dev/ttyACM0 -F /var/run/gpsd.sock
RPi1: /usr/sbin/gpsd -D 5 -n /dev/ttyACM0 -F /var/run/gpsd.sock

cgps -s 127.0.0.1:1024
RPi1: cgps -s

Latitude: 40.358424 N
Longitude: 28.909791 E

Latitude: 40.358545 N
Longitude: 28.909723 E

/etc/default/gpsd
GPSD_OPTIONS=“-n“

# Default settings for gpsd.
# Please do not edit this file directly – use `dpkg-reconfigure gpsd‘ to
# change the options.
START_DAEMON=“true“
GPSD_OPTIONS=“-n /dev/ttyACM0″
DEVICES=““
USBAUTO=“true“
GPSD_SOCKET=“/var/run/gpsd.sock“

oder
# Default settings for gpsd.
# Please do not edit this file directly – use `dpkg-reconfigure gpsd‘ to
# change the options.
START_DAEMON=“true“
GPSD_OPTIONS=“-n“
DEVICES=“/dev/ttyS0″
USBAUTO=“false“
GPSD_SOCKET=“/var/run/gpsd.sock“

 

sudo service gpsd start
sudo service gpsd stop

# Add the following to `/etc/ntp.conf`
# ==============================================
# GPS Serial data reference
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.0 refid GPS

# GPS PPS reference
server 127.127.28.1 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.1 refid PPS
# ==============================================

To verify that the GPS module is indeed feeding ntpd, run the command `ntpq -p` in a terminal

ntpd -q -g
apt-get install ntpdate
ntpdate NTP-Server
ntpdate ptbtime1.ptb.de

root@Neo2:~# ntpdate 192.168.6.3
8 Sep 22:48:37 ntpdate[2489]: step time server 192.168.6.3 offset 9.530871 sec

hwclock –systohc

LEDs des NanoPi Neo2 konfigurieren (und weitere)

4. Oktober 2017

root@NanoPi-NEO2:~# ls -l /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 1970 nanopi:blue:status -> ../../devices/platfo rm/leds/leds/nanopi:blue:status
lrwxrwxrwx 1 root root 0 Jan 1 1970 nanopi:green:pwr -> ../../devices/platform /leds/leds/nanopi:green:pwr

root@NanoPi-NEO2:~# cat /sys/class/leds/nanopi:blue:status/trigger
none rfkill-any kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock usbport usb-gadget usb-host mmc0 [heartbeat] cpu0 cpu1 cpu2 cpu3 rc-feedback 1c30000.ethernet-0:00:1Gbps 1c30000.ethernet-0:00:100Mbps 1c30000.ethernet-0:00:10Mbps

echo „heartbeat“ > /sys/class/leds/nanopi:blue:status/trigger
root@NanoPi-NEO2:~# echo heartbeat > /sys/class/leds/nanopi:green:pwr/trigger
root@NanoPi-NEO2:~# echo mmc0 > /sys/class/leds/nanopi:blue:status/trigger

RPi_One B1+:
echo „heartbeat“ > /sys/devices/platform/leds/leds/led0/trigger
echo „mmc0“ > /sys/devices/platform/leds/leds/led1/trigger

RPi3:
# gruene LED
echo „mmc0“ > /sys/devices/platform/leds/leds/led0/trigger
# rote LED
echo „heartbeat“ > /sys/devices/platform/leds/leds/led1/trigger

BPi LEDs:
# led1=red
echo „heartbeat“ > /sys/class/leds/led1/trigger
# led2=green
echo „mmc0“ > /sys/class/leds/led2/trigger

 

aktive IPs im eigenen Netz finden

4. Oktober 2017

nmap –open -sn 192.168.6.*

Pi-Hole installieren und updaten

4. Oktober 2017

https://pi-hole.net/
curl -sSL https://install.pi-hole.net | bash

pihole -up: Ein Update des Pi-hole durchführen
pihole -r: Den Konfigurator nochmal aufrufen, um bspw. Änderungen am DNS vorzunehmen
pihole -g: Update der Blockierlisten anstoßen

Bluetooth Speaker via Commandline

4. Oktober 2017

Scan:
root@orangepizero:~# hcitool scan
Scanning …
30:21:8E:AA:4C:45 ML-28U
00:11:67:3F:9B:18 BTLS9001

root@orangepizero:~# bt-adapter -d
Searching…
[30:21:8E:AA:4C:45]
Name: ML-28U
Alias: ML-28U
Address: 30:21:8E:AA:4C:45
Icon: (null)
Class: 0x0
LegacyPairing: 0
Paired: 0
RSSI: -60

Eigenes Device:
root@orangepizero:~# hcitool dev
Devices:
hci0 00:1A:7D:DA:71:13

Pair:
root@orangepizero:~# bt-device -c 30:21:8E:AA:4C:45
Connecting to: pcm.bluetooth {
type bluetooth
device „XX:XX:XX:XX:XX:XX“
profile „auto“
}
Done

Trust:
bt-device –set 30:21:8E:AA:4C:45 Trusted 1
bt-device –set ML-28U Trusted 1

enable bluetooth sound on bluetooth hub:
hciconfig hci0 voice 0x0060

/usr/bin/bt-obex
/usr/bin/bt-adapter
/usr/bin/bt-device
/usr/bin/bt-network
/usr/bin/bt-agent

start bt-agent als daemon:
root@pistretch:/home/pi# bt-agent -d
Agent registered
Default agent requested

Discover:
bt-adapter -d

Connect:
bt-device -c 00:11:67:3F:9B:18

Trust:
root@pistretch:/home/pi# bt-device –set 00:11:67:3F:9B:18 Trusted 1
Trusted: 0 -> 1

Info:

@pistretch:/home/pi# bt-device -i 00:11:67:3F:9B:18
[00:11:67:3F:9B:18]
Name: BTLS9001
Alias: BTLS9001 [rw]
Address: 00:11:67:3F:9B:18
Icon: audio-card
Class: 0x240414
Paired: 1
Trusted: 1 [rw]
Blocked: 0 [rw]
Connected: 0
UUIDs: [AudioSink, AVRemoteControlTarget, AVRemoteControl, PnPInformation]

search & replace im vi

4. Oktober 2017

:%s/foo/bar/g
Find each occurrence of ‚foo‘ (in all lines), and replace it with ‚bar‘.
:s/foo/bar/g
Find each occurrence of ‚foo‘ (in the current line only), and replace it with ‚bar‘.
:%s/foo/bar/gc
Change each ‚foo‘ to ‚bar‘, but ask for confirmation first.

Play Internet Radio via command line

4. Oktober 2017

mpg123 -@ /home/guido/absolut_128.m3u
mpg321 -@ /home/guido/absolut_128.m3u -o alsa

Play .ogg via command line

4. Oktober 2017

apt-get install vorbis-tools
ogg123 lied.ogg
ogg123 -d alsa lied.ogg

Konfig Soundkarte NanoPi Neo2

4. Oktober 2017

asound.conf Neo2

#pcm.!default {
# type hw
# card 0 #If you want to set HDMI as output ,turn 0 to 1.
# device 0
#}
#
#ctl.!default {
# type hw
# card 0 #If you want to set HDMI as output ,turn 0 to 1.
#}

pcm.!default {
type hw
card 1 #If you want to set HDMI as output ,turn 0 to 1.
device 0
}

ctl.!default {
type hw
card 1 #If you want to set HDMI as output ,turn 0 to 1.
}

Neo2 USB espeak

espeak -vde -w /tmp/espeak.wav -s165 „Guten Tag, wie geht es Ihnen??“; aplay -D plughw:1,0 /tmp/espeak.wav 2>/dev/null

 

date +’Es ist nun %k Uhr %M.‘ > /home/guido/speak.txt

echo $1 > /home/guido/speak.txt; espeak -vde -f /home/guido/speak.txt -w /tmp/espeak.wav -s165; aplay -D plughw:1,0 /tmp/espeak.wav 2>/dev/null; rm /home/guido/speak.txt