Open main menu

DAVE Developer's Wiki β

Changes

Accessing hardware peripherals (SDVX)

9,742 bytes added, 13:22, 7 December 2018
hostapd
echo 1 > /sys/class/leds/bt_command_mode/brightness
root@sdv03-lite:~#
</pre>
 
=== Wifi ===
An wifi network can be accessed using an ''USB wireless adapter'' device like the [https://www.lm-technologies.com/product/wifi-usb-adapter-150mbps-lm006/ LM006].
 
==== firmware ====
Tipically, the wifi adapter requires a firmware file stored into the ''/lib/firmware'' directory, for example, inserting the LM006 without the firmware file, the kernel messages:
 
<pre>
[ 39.849654] rtlwifi: Loading alternative firmware rtlwifi/rtl8192cufw.bin
[ 39.856719] rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available
</pre>
 
while, once the correct firmware is present:
 
<pre>
root@sdv03-lite:~# ls -la /lib/firmware/rtlwifi/
total 24
drwxr-xr-x 2 root root 4096 Dec 5 2018 .
drwxr-xr-x 5 root root 4096 Dec 5 2018 ..
-rw-r--r-- 1 root root 16116 Dec 5 2018 rtl8192cufw_TMSC.bin
root@sdv03-lite:~#
</pre>
 
the device is correctly initialized
 
<pre class="workstation-terminal">
root@sdv03-lite:~# [ 97.170926] usb 2-1: USB disconnect, device number 2
[ 99.273660] usb 2-1: new high-speed USB device number 3 using ci_hdrc
[ 99.425910] usb 2-1: New USB device found, idVendor=0bda, idProduct=8176
[ 99.432668] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 99.440840] usb 2-1: Product: 802.11n WLAN Adapter
[ 99.445740] usb 2-1: Manufacturer: Realtek
[ 99.449962] usb 2-1: SerialNumber: 00e04c000001
[ 99.460018] rtl8192cu: Chip version 0x10
[ 99.556498] rtl8192cu: MAC address: 5c:f3:70:1a:8a:43
[ 99.561587] rtl8192cu: Board Type 0
[ 99.565608] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[ 99.571697] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[ 99.581909] ieee80211 phy1: Selected rate control algorithm 'rtl_rc'
 
root@sdv03-lite:~# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 5c:f3:70:1a:8a:43
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
 
root@sdv03-lite:~#
</pre>
 
==== network scan ====
 
* the <code>rfkill unblock</code> should be issued before scanning the wireless network
 
<pre class="workstation-terminal">
root@sdv03-lite:~# rfkill unblock 0
</pre>
 
* then using <code>iw</code> command, the list of network will appear
 
<pre class="workstation-terminal">
root@sdv03-lite:~# iw wlan0 scan
BSS 20:aa:4b:22:55:5e(on wlan0)
TSF: 31687164214 usec (0d, 08:48:07)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
signal: -44.00 dBm
last seen: 230 ms ago
Information elements from Probe Response frame:
SSID: davesrl
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0* 36.0 54.0
DS Parameter set: channel 6
ERP: <no flags>
ERP D4.0: <no flags>
Extended supported rates: 6.0* 9.0 12.0* 48.0
WPA: * Version: 1
* Group cipher: TKIP
* Pairwise ciphers: TKIP
* Authentication suites: PSK
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS 22:aa:4b:22:55:5f(on wlan0)
TSF: 31687167783 usec (0d, 08:48:07)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
signal: -48.00 dBm
last seen: 230 ms ago
Information elements from Probe Response frame:
SSID: daveguest
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0* 36.0 54.0
DS Parameter set: channel 6
ERP: <no flags>
ERP D4.0: <no flags>
Extended supported rates: 6.0* 9.0 12.0* 48.0
WPA: * Version: 1
* Group cipher: TKIP
* Pairwise ciphers: TKIP
* Authentication suites: PSK
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-1023, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 2, TXOP 3008 usec
* VO: CW 3-7, AIFSN 2, TXOP 1504 usec
BSS fe:3f:db:b9:b9:c9(on wlan0)
TSF: 31696360436 usec (0d, 08:48:16)
freq: 2437
beacon interval: 100 TUs
capability: ESS Privacy SpectrumMgmt ShortSlotTime (0x0511)
signal: -88.00 dBm
last seen: 240 ms ago
SSID: DIRECT-C9-HP PageWide Pro 477dw
Supported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0
DS Parameter set: channel 6
Power constraint: 0 dB
TPC report: TX power: 17 dBm
ERP: <no flags>
ERP D4.0: <no flags>
RSN: * Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
HT capabilities:
Capabilities: 0x20
HT20
Static SM Power Save
RX HT20 SGI
No RX STBC
Max AMSDU length: 3839 bytes
No DSSS/CCK HT40
Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT RX MCS rate indexes supported: 0-7
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 6
* secondary channel offset: no secondary
* STA channel width: 20 MHz
* RIFS: 1
* HT protection: nonmember
* non-GF present: 0
* OBSS non-GF present: 1
* dual beacon: 0
* dual CTS protection: 0
* STBC beacon: 0
* L-SIG TXOP Prot: 0
* PCO active: 0
* PCO phase: 0
WMM: * Parameter version 1
* u-APSD
* BE: CW 15-63, AIFSN 3
* BK: CW 15-1023, AIFSN 7
* VI: CW 7-15, AIFSN 1, TXOP 3008 usec
* VO: CW 3-7, AIFSN 1, TXOP 1504 usec
WPS: * Version: 1.0
* Wi-Fi Protected Setup State: 2 (Configured)
* Response Type: 3 (AP)
* UUID: 80257526-6702-757d-ca10-7efc225144a8
* Manufacturer: HP
* Model: HP PageWide Pro 477dw MFP
* Model Number: D3Q20B
* Serial Number: CN716FX062
* Primary Device Type: 3-0050f204-1
* Device name:
* Config methods: Display
* Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20
* Unknown TLV (0x1049, 23 bytes): 00 01 37 10 06 00 10 80 25 75 26 67 02 75 7d ca 10 7e fc 22 51 44 a8
root@sdv03-lite:~#
</pre>
 
==== wifi host spot ====
It is possible to create an ''wifi hotspot'' simply configuring the hostapd daemon.
 
* verify against supported modes
 
<pre class="workstation-terminal">
root@sdv03-lite:~# iw list | grep "Supported interface modes" -A 8
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* P2P-client
* P2P-GO
Band 1:
root@sdv03-lite:~#
</pre>
 
* example of configuration file ''/etc/hostapd.conf''
 
<pre>
interface=wlan0
ssid=sdv03-test
channel=1
wpa=2
wpa_passphrase=sdv03password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
</pre>
 
* kill any ''wpa_supplicant daemon'' and unblock ''rfkill''
 
<pre class="workstation-terminal">
root@sdv03-lite:~# killall wpa_supplicant
root@sdv03-lite:~# rfkill unblock wifi
</pre>
 
* start the ''hostapd''
 
<pre class="workstation-terminal">
root@sdv03-lite:~# /etc/init.d/hostapd start
Starting HOSTAP Daemon: Configuration file: /etc/hostapd.conf
[ 823.569111] rtl8192cu: MAC auto ON okay!
[ 823.606635] rtl8192cu: Tx queue select: 0x05
[ 824.472331] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Using interface wlan0 with hwaddr 5c:f3:70:1a:8a:43 and ssid "sdv03-test"
random: Only 12/20 bytes of strong random data available from /dev/random
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool for secure ope[ 824.551065] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
rations - update keys later when the first station connects
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
hostapd.
root@sdv03-lite:~#
</pre>
 
* show wlan0 status
<pre>
root@sdv03-lite:~# iw wlan0 info
Interface wlan0
ifindex 5
wdev 0x100000001
addr 5c:f3:70:1a:8a:43
ssid sdv03-test
type AP
wiphy 1
channel 1 (2412 MHz), width: 20 MHz (no HT), center1: 2412 MHz
root@sdv03-lite:~#
</pre>
 
* configure ''dhcpd'' server (it is possible to use, for example, '''busybox-udhcpd-1.24.1''' as dhcpd daemon) and start it
 
<pre class="workstation-terminal">
root@sdv03-lite:~# cat /etc/udhcpd.conf
start 192.168.1.10
end 192.168.1.250
interface wlan0
siaddr 192.168.1.1
option lease 864000
root@sdv03-lite:~# /etc/init.d/busybox-udhcpd start
starting Busybox UDHCP Server: udhcpd... done.
root@sdv03-lite:~#
</pre>
8,226
edits