Failed to create virtual interface using iw - raspberry-pi3

When I tried to create a virtual interface using
sudo iw phy `ls /sys/class/ieee80211/` interface add p2p0 type managed
it is showing command failed: Device or resource busy (-16). And I tried this too
sudo iw phy phy0 interface add p2p0 type managed addr 12:34:56:78:90:12
it is giving the same output.
This command is tried on Raspberry Pi running on Raspbian stretch. How can I create a Virtual interface?

Related

unshare network with loopback enabled

To run tests on the development build of my program I need to isolate it from the network.
The build still needs access to loopback (127.0.0.1) though.
I tried using unshare -c -n <program> but the loopback interface is down by default.
Using unshare -r -n bash allows me to enable the interface by using ip link set lo up but the program needs to be invoked manually in that bash shell then.
I tried to create a persistent network namespace (ip netns add vnet1) but that only works with sudo which I need to avoid.
So it is possible to create a unshared network namespace with lo down, without using sudo.
I need to get the lo interface up before launching the build. Ideally I'd integrate the the setup in a bash script without using privilege escalation.
I've read that fedora provides a enabled loopback interface by default, so can I adjust this behavior with sysctl etc. ? (I'm on archlinux)

how to display velodyne points on ROS installed on "Ubuntu on Mac" via Parallels Desktop on macOS?

This is probably easy but I am a noob in networks so please help!
Basically I am trying to display lidar points from my Velodyne VLP-16 on ROS installed on Ubuntu 18.04 which is in turn installed via Parallels Desktop on my macOS.
So I plugged the velodyne's ethernet cable to my MacBook via a usb-C-to-ethernet adapter and set this on my mac:
I can type in my browser this address 192.168.1.201 and I can see the velodyne interface. So it works.
When I now go to "Ubuntu on Mac" via Parallels Desktop and do not change anything in Network->Settings->Wired->Connected so I can see these settings:
... I can still see the velodyne interface via a browser on Ubuntu by typing the 192.168.1.201 address as I can on macOS.
The only problem is that when I wanna run
roslaunch velodyne_pointcloud VLP16_points.launch
it says that:
[ INFO] [1592867527.026682801]: Opening UDP socket: port 2368
[ WARN] [1592867528.028658170]: Velodyne poll() timeout
[ERROR] [1592867528.029191798]: DriverNodelet::devicePoll - Failed to poll device.
so it does not work.
I have tried to look up something similar but I failed cos my knowledge in networks is very limited. Following this tutorial I could not get this command through cos it says:
maciej#ubuntu:~$ sudo ifconfig eth0 192.168.3.100
[sudo] password for maciej:
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
Interestingly, when I change the IP address on "Ubuntu on Mac" to this:
I cannot see the Velodyne interface in my browser on Ubuntu, but I still can on my macOS.
I will just add that when I follow the mentioned tutorial on Ubuntu installed on a PC (not via Parallels Desktop on mac), everything works.
Please help bosses!
After a thorough examination of the network traffic both on macOS and on the emulated Ubuntu using Wireshark on both ends, I realised that there is no Network adapter present in the virtual machine configuration.
Following the answer from Desktop Parallel support, I did:
Ubuntu on Mac -> configure -> hardware -> add device -> network 2 -> source: USB...
and when you check now in Wireshark, you will see the traffic coming from the USB adapter and the ROS driver, via an adequate port, will capture the packets.

raspberry pi 3 iot agent unable to connect cumulocity platform

I have installed noobs v2_4_5 in raspberry pi 3 model ,configured JAVA_HOME, enabled SSH and set up static IP as well. I downloaded IOT agent cumulocity-rpi-agent-latest.deb and installed using the following 2 commands
$ wget http://resources.cumulocity.com/examples/cumulocity-rpi-agent-latest.deb
$ sudo dpkg -i cumulocity-rpi-agent-latest.deb
I registered the device in cumulocity platform. When agent is installed I should update cfg file cumulocity.properties located at /usr/share/cumulocity-rpi-agent/cfg. The file needs the following.
host
bootstrap.tenant
bootstrap.user
bootstrap.password
My account url is - arpita.cumulocity.com. What exactly I have to put in that file and any thing more I have to do to make active connection? Also device.properties file is not generating after agent installation. How to proceed?
I found the correct answer to this question.
After registering your raspberry Pi 3 on Cumulocity and updating your cumulocity.properties file, you need to enable SPI.
Here is a reference how to do that.
After SPI is enabled, you will see your device status on Cumulocity is waiting for you to accept the connection.

How to emulate USB flash drive and read data simultaneous

I have a device that saves screenshots when you put a flash drive with exFAT/FAT32 and a specific directory tree in its USB socket. I want to livestream these screenshots to other devices as fast as possible via ethernet:
device -> flash drive -> ethernet
So I tried an ARM device (Orange Pi Zero) with OTG support and g_mass_storage kernel module which emulates an USB flash drive via USB OTG:
g_mass_storage - To have your Pi Zero appear as a mass storage device
(flash drive), first create a mini filesystem in a file on your Pi
with sudo dd if=/dev/zero of=/piusb.bin bs=512 count=2880 and set it
up as a fat32 filesystem with sudo mkdosfs /piusb.bin. Then, when
enabling it, add file=/piusb.bin stall=0 onto the end, for example
sudo modprobe g_mass_storage file=/piusb.bin stall=0.
(from https://gist.github.com/gbaman/50b6cca61dd1c3f88f41)
Next I mounted the emulated flash drive for testing purpose on a Laptop (Linux Mint 18) and the flash drive file via sudo mount /piusb.bin /mnt/ on the ARM device. But when I add new files/directories in one system it doesn't appear on the other. I have to remount the device/file first to refresh the files.
So is it even possible to read (and stream) the written data at the same time on my ARM device with g_mass_storage? Or is there a better way to solve my problem?
You should try to remount it.
sudo umount /mnt/
sudo mount /piusb.bin /mnt/

How to reference an USB port via avrdude?

avrdude has the option p which permits you to determine which port should be used.
By checking the USB settings of my USBASP, it says it is connected through the port#0002.hub#0001. So I tried the following:
avrdude -p m168p -c avrisp -P com2 -b 19200
Unfortunately it didn't work:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
USBASP has been updated to the latest version and the -F option doesn't work either.
Am I referencing the USB port correctly by calling is COM2?
Any ideas on how to make it work?
USB port number have nothing to do with the COM port number. (COM are virtual nowadays)
Basically you want to know which COM port windows uses for your USB device.
Go to your device manager to see what COM port your avr writing device is using:
com port info
You can even change it via your USB device's properties if you want.
(Properties -> Port settings -> Port COM number)

Resources