WiFi direct failure to connect Raspberry Pi to Android - raspberry-pi

I'm attempting to connect an Android Phone to a Raspberry Pi over WiFi Direct however when the Pi is the group owner (GO) it always fails to form a group. If I create a group on the Android device first and then have the Pi join it connects as expected and I can run iperf to test the connection.
On the Pi side I'm running the following commands with wpa_cli:
Selected interface 'p2p-dev-wlan0'
Interactive mode
p2p_find
OK
CTRL-EVENT-SCAN-STARTED
wps_pbc
OK
P2P-DEVICE-FOUND 32:07:4d:78:91:6d p2p_dev_addr=32:07:4d:78:91:6d pri_dev_type=10-0050F204-5 name='[Phone] Galaxy S8' config_methods=0x188 dev_capab=0x25 group_capab=0x0 vendor_elems=1 new=1
P2P-PROV-DISC-PBC-REQ 32:07:4d:78:91:6d p2p_dev_addr=32:07:4d:78:91:6d pri_dev_type=10-0050F204-5 name='[Phone] Galaxy S8' config_methods=0x188 dev_capab=0x25 group_capab=0x0
P2P-GO-NEG-REQUEST 32:07:4d:78:91:6d dev_passwd_id=4 go_intent=0
p2p_connect 32:07:4d:78:91:6d pbc
OK
P2P-FIND-STOPPED
P2P-GO-NEG-SUCCESS role=GO freq=2462 ht40=0 peer_dev=32:07:4d:78:91:6d peer_iface=32:07:4d:78:11:6d wps_method=PBC
P2P-GROUP-FORMATION-FAILURE
P2P-GROUP-REMOVED p2p-wlan0-1 GO reason=FORMATION_FAILED
And here's the log:
P2P-DEVICE-FOUND 32:07:4d:78:91:6d p2p_dev_addr=32:07:4d:78:91:6d pri_dev_type=10-0050F204-5 name='[Phone] Galaxy S8' config_methods=0x188 dev_capab=0x25 group_capab=0x0 vendor_elems=1 new=1
P2P-PROV-DISC-PBC-REQ 32:07:4d:78:91:6d p2p_dev_addr=32:07:4d:78:91:6d pri_dev_type=10-0050F204-5 name='[Phone] Galaxy S8' config_methods=0x188 dev_capab=0x25 group_capab=0x0
P2P-GO-NEG-REQUEST 32:07:4d:78:91:6d dev_passwd_id=4 go_intent=0
P2P-FIND-STOPPED
P2P-GO-NEG-SUCCESS role=GO freq=2462 ht40=0 peer_dev=32:07:4d:78:91:6d peer_iface=32:07:4d:78:11:6d wps_method=PBC
p2p-wlan0-1: Could not connect to kernel driver
Using interface p2p-wlan0-1 with hwaddr f6:f7:f3:7e:19:d6 and ssid "DIRECT-dK"
Failed to set beacon parameters
p2p-wlan0-1: Could not connect to kernel driver
Interface initialization failed
p2p-wlan0-1: interface state UNINITIALIZED->DISABLED
p2p-wlan0-1: AP-DISABLED
p2p-wlan0-1: Unable to setup interface.
Failed to initialize AP interface
p2p-wlan0-1: interface state DISABLED->DISABLED
p2p-wlan0-1: AP-DISABLED
hostapd_free_hapd_data: Interface p2p-wlan0-1 wasn't started
p2p-wlan0-1: CTRL-EVENT-DISCONNECTED bssid=f6:f7:f3:7e:19:d6 reason=3 locally_generated=1
P2P-GROUP-FORMATION-FAILURE
P2P-GROUP-REMOVED p2p-wlan0-1 GO reason=FORMATION_FAILED
p2p-wlan0-1: CTRL-EVENT-DISCONNECTED bssid=f6:f7:f3:7e:19:d6 reason=3 locally_generated=1
nl80211: deinit ifname=p2p-wlan0-1 disabled_11b_rates=0
P2P-DEVICE-LOST p2p_dev_addr=32:07:4d:78:91:6d
p2p-dev-wlan0: WPS-TIMEOUT Requested operation timed out
In the log there's an obvious error 'p2p-wlan0-1: Could not connect to kernel driver' but I wouldn't know where to look next to investigate this?

Related

Kismet fails to create wlan1mon

Kismet Device error
OS: Opensuse Tubleweed
Dual Band Wireless-AC 7265
Intel
kernel: iklwifi / wlan1
error:
INFO: Probing interface 'wlan1' to find datasource type
INFO: Found type 'linuxwifi' for 'wlan1'
INFO: Opened kismetdb log file './/Kismet-20220228-12-15-59-1.kismet'
INFO: Saving packets to the Kismet database log.
INFO: Starting Kismet web server...
INFO: HTTP server listening on 0.0.0.0:2501
FATAL: Datasource helper failed, could not process incoming control packet.
ERROR: wlan1 failed to create monitor vif interface 'wlan1mon' for
interface 'wlan1': failed to create monitor interface wlan1:wlan1mon
ERROR: Data source 'wlan1 / wlan1' ('wlan1') encountered an error: wlan1
could not bring down interface 'wlan1' to set monitor mode: failed
to set flags on interface 'wlan1': Operation not permitted
ALERT: SOURCEERROR Source wlan1 (5FE308BD-0000-0000-0000-A402B937F7B2) has
encountered an error (wlan1 could not bring down interface 'wlan1'
to set monitor mode: failed to set flags on interface 'wlan1':
Operation not permitted) Kismet will attempt to re-open the source
in 5 seconds. (1 failures)
i try
iwconfig wlp2s0 mode monitor
nmcli device set wlan1 managed true
iwconfig wlan0 mode managed
in several combination
iwconfig
shows:
wlan1 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
or:
wlan1 IEEE 802.11 Mode:Monitor Tx-Power=-2147483648 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
so i need some help for config kismet

Raspberry Pi CM4 UBoot NVME-access

Does anyone have a working UBoot config for accessing an NVME drive from UBoot running on a Raspberry Pi CM4?
I've compiled everything and UBoot is detecting my NVME correctly:
pci_bind_bus_devices: bus 1/pci_0:0.0: found device 0, function 0: find ret=-19
pci_find_and_bind_driver: Searching for driver: vendor=2646, device=2263
pci_find_and_bind_driver: Match found: nvme
pci_auto_config_devices: start
pci_auto_config_devices: device nvme#0
PCI Autoconfig: BAR 0, Mem, size=0x4000, address=0xc0000000 bus_lower=0xc0004000
pci_auto_config_devices: done
but it doesnt call nvme_uclass_post_probe() and therefore it doesnt create any block device.
Running the command "nvme scan" from the UBoot command line i'am getting a timeout in nvme_submit_sync_cmd(). -> ETIMEDOUT.
I'am using a Kingston A2000 SDD with the latest firmware "S5Z42109".
Does anyone have an idea?
Thanks.

Modbus RTU on an Raspberry Pi 3b+ as an master

My task is to develop an automation system for testing the device.
I have at my disposal:
raspberry pi(3b+/4)
modbus modules: icp con m - 7051D, m - 7055D, m-7061D, and few others.
At first I want to understand, how I can implement modbus protocol on RPi, how does it work.
In order to do that, I've used pymodbus library on RPi, which was working as an master, and modbusMAT on an PC, for recieving and decoding instructions from RPi. They were connected via rs-485 - USB adapter.
I've written some simple code, for writing a coil.
The RPi is communciating with PC, but the problem is, that the output, doesn't make sense to me.
Here's the code:
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
client = ModbusClient(method = 'rtu', port='/dev/ttyUSB0', stopbits=1, bytesize = 8, parity='N', baurdrate = '9600', timeout=0.3)
connection = client.connect()
print (connection)
client.write_coils(1, 1, unit=0x01)
Screenshot from modbusMat console
The output:
[9C][84][8C][E4][FF]
[9C][08][8C][B4][FF]
[9C][84][8C][E4][FF]
[38][18][18][8C][CA]
The output is related to changes I've made parameters. From top to bottom:
address=1, values=1, unit=0x01
address=2, values=1, unit=0x01
address=1, values=2, unit=0x01
address=1, values=1, unit=0x02
How I understand is, that if I've set address to 1, then the addres byte on the console should be the same - [01], not [9C].
I've managed before to successfully send some instructions to the icp modules(turn on, turn off coil) from PC, via RS-485 but not from RPi.

RPi3 with SenseHat and Yocto

I am currently working with building a Yocto Image for the RPi3 with the SenseHat installed.
The Yocto image consist of the following layers:
meta
meta-poky
meta-oe
meta-networking
meta-python
meta-raspberrypi
meta-java
an application-specific layer.
The application-specific layer is mainly tasked with loading the following kernel-modules:
i2c-dev
fb_sys_fops
syscopyarea
sysfillrect
sysimgblt
rpisense_core
rpisense_js
rpisense_fb
It also contains openssh, psplash, gcc, make, libiio, rtimulib and some other misc. packages.
My image boots nicely without the SenseHat mounted, but the boot-process stops before reaching the UART shell when it is mounted. It stays frozen until the system is reset by the watchdog.
Following is the last part of the UART output before the system freezes.
{...}
Populating dev cache
ALSA: Restoring mixer settings...
/usr/sbin/alsactl: load_state:1735: No soundcards found...
Tue Nov 1 10:01:54 UTC 2016
INIT: Entering runlevel: 5
Configuring network interfaces... [ 5.130327] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
udhcpc (v1.24.1) started
Sending discover...
[ 6.662428] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
[ 6.688217] cfg80211: Calling CRDA to update world regulatory domain
Sending discover...
Sending select for 192.168.0.106...
Lease of 192.168.0.106 obtained, lease time 3600
/etc/udhcpc.d/50default: Adding DNS 192.168.0.20
/etc/udhcpc.d/50default: Adding DNS 192.168.0.40
done.
Starting system message bus: dbus.
Starting OpenBSD Secure Shell server: sshd
[ 9.034713] NET: Registered protocol family 10
done.
Starting rpcbind daemon...done.
Starting advanced power management daemon: No APM support in kernel
(failed.)
Starting bluetooth
bluetoothd
Starting syslogd/klogd: done
* Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
[ 9.401783] Bluetooth: Core ver 2.20
[ 9.405528] NET: Registered protocol family 31
[ 9.410088] Bluetooth: HCI device and connection manager initialized
[ 9.416576] Bluetooth: HCI socket layer initialized
[ 9.421576] Bluetooth: L2CAP socket layer initialized
[ 9.426747] Bluetooth: SCO socket layer initialized
...done.
Starting Telephony daemon
[ 9.507315] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 9.512765] Bluetooth: BNEP filters: protocol multicast
[ 9.518098] Bluetooth: BNEP socket layer initialized
Starting Linux NFC daemon
[ 9.624816] nfc: nfc_init: NFC Core ver 0.1
[ 9.629241] NET: Registered protocol family 39
I shoould note that I have soldered three wires onto the UART pins:
RPi3 UART pins http://www.embeddedforu.com/wp-content/uploads/2015/06/Raspberry-pi-UART-connections_thumb.png
When the system is frozen, I can still ping the device, but SSH does not work.
Any idea what might be causing this behavior?
It turned out that the problem lay within the yocto local.conf-file. The following line was set:
ENABLE_I2C = "1"
This created a second i2c-driver, which lead to one of the crashing on boot.
For any googlers out there: This flag does not need to be set. Instead make sure that the i2c-dev kernel driver is loaded at boot.
I never used the bluetooth, but it seems the system doesn't freeze, you just lose UART data when Bluetooth connects.
From here:
On the rpi3, it is normal since the BCM2837 on the Raspberry Pi3 has 2 UARTs (as did its predecessors), however to support the Bluetooth functionality the fully featured PL011 UART was moved from the header pins to the Bluetooth chip and the mini UART made available on header pins 8 & 10.
This has a number of consequences for users of the serial interface.
The /dev/ttyAMA0 previously used to access the UART now connects to Bluetooth.
I would advise you to try again having in config.txt
dtoverlay=pi3-disable-bt
enable_uart=1
And if you really need bluetooth, use
dtoverlay=pi3-miniuart-bt
And for the ssh, add "openssh" in your image recipe, and dependencies to connect like wpa-supplicant (don't forget to configure it)

Can't register rteth0 for FEC Ethernet card on SabreLite iMX6Q

I'm a new user on RTnet and try to make Rtnet work on Freescale Sabre Lite iMX6Q board. But I got an issue, RTnet can't use rt_fec.ko module driver to register rt_eth0 even though non real time driver is disable.
I'm using:
Linux kernel 3.0.43 download from Xenomai git://git.xenomai.org/ipipe-gch.git/?h=ipipe-3.0-imx6q
Xenomai 2.6 download from git.xenomai.org/xenomai-2.6.git/
RTnet 0.9.13 download from rtnet.org/download.html
Please see my kernel configuration and boot log in attached link.
Xenomai is loaded:
"*I-pipe: Domain Xenomai registered.
Xenomai: hal/arm started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.6.3 (Lies and Truths) loaded.
Xenomai: debug mode enabled.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.* "
And FEC ethernet driver (non real-time driver) is loaded when kernel is booting
*"FEC Ethernet Driver
fec_enet_mii_bus: probed "*
Xenomai is built following install guideline for ARM platform from Xenomai:
http://xenomai.org/installing-xenomai-2-x/
RTnet is built by below command, because SABRE Lite use FEC ethernet card with Micrel KSZ9021 Gigabit chip so I put "--enable-fec" in configure command to build real-time driver for FEC ethernet card:
"./configure --host=armv7l-timesys-linux-gnueabi --with-rtext-config=/home/sonnguyen/rtnet-xenomai-rootfs/usr/xenomai/bin/xeno-config --with-linux=/home/sonnguyen/build/rtnet-xenomai-ipipe-imx6q --enable-rtcfg-dbg --enable-rtwlan --enable-net-routing --enable-router --enable-nomac --enable-rtcap --enable-proxy --enable-checks --enable-fec "
Then
"make DESTDIR=/home/sonnguyen/rtnet-xenomai-rootfs install"
I also changed RT_DRIVER from default value to "rt_fec" in rtnet.conf.
After kernel is booted, I ran "./rtnet start" and got this:
"RTnet: initialising real-time networking
RT FEC Ethernet Driver
./rtnet: line 385: can't create /sys/bus/pci/drivers/rt_fec/bind: nonexistent directory
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device "
Then I tried:
"# lspci
lspci: /sys/bus/pci/devices: No such file or directory
ls /sys/bus/
ac97 hid mdio_bus platform sdio spi
event_source i2c mmc scsi serio usb "
No pci directory under /sys/bus/. Then I thought because the script can't find the ethernet physical bus, it can't register rteth0.
Then I looked into rtnet script and did some minor change. In the script it requires physical ethernet device ID (mentioned in REBIND_RT_NICS), so I tried to find out what it is and got this when make eth0 up with non real-time driver:
"eth0: Freescale FEC PHY driver [Micrel KSZ9021 Gigabit PHY] (mii_bus:phy_addr=1:06, irq=-1)
PHY: 1:06 - Link is Up - 1000/Full "
I think 1:06 is my physical bus ID, then I change the code in rtnet from:
for dev in $REBIND_RT_NICS; do
if [ -d /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
done
To
echo 1:06 > /sys/bus/mdio_bus/drivers/Micrel\ KSZ9021\ Gigabit\ PHY/unbind
echo 1:06 > /sys/bus/platform/drivers/rt_fec/bind
And I tried again with "./rtnet start", this time I got this:
RTnet: initialising real-time networking
RT FEC Ethernet Driver
sh: write error: No such device
initializing loopback...
RTnet: registered rtlo
RTcap: real-time capturing interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCGIFFLAGS: No such device
RTcfg: init real-time configuration distribution protocol
RTmac: init realtime media access control
RTmac/TDMA: init time division multiple access control mechanism
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl: No such device
ioctl (add): No such device
ioctl (add): No such device
ioctl (add): No such device
ifconfig: SIOCGIFFLAGS: No such device
Waiting for all slaves...ioctl: No such device
ioctl: No such device
But it still said "No such device"
This is lsmod after I ran ./rtnet start
lsmod
Module Size Used by Not tainted
tdma 25691 0
rtmac 9724 1 tdma
rtcfg 58071 0
rtcap 7151 0
rt_loopback 1279 2
rtpacket 6365 0
rtudp 10738 0
rt_fec 12742 0
rtipv4 29987 2 rtcfg,rtudp
rtnet 40746 9 tdma,rtmac,rtcfg,rtcap,rt_loopback,rtpacket,rtudp,rt_fec,rtipv4
./rtifconfig
rtlo Medium: Local Loopback
IP address: 127.0.0.1
UP LOOPBACK RUNNING MTU: 1500
Only rtlo is registered.
I also tried with kernel linux without non real-time FEC driver (please refer in another config file in attached Skydrive link), but still the same issue happened.
Do you have any idea how to solve this issue? I did many search but still can not figure out how to fix it.
Because I can't attach the files to my post, so I put all of my configuration files in the link below:
https://onedrive.live.com/redir?resid=162EDF85AEBD2EFE!717&authkey=!AJ1Fjd_XiohUwes&ithint=file%2czip
Best Regards,
Nguyen Hung Son