I googled before asking here , but I do not want to crash or brake system. So I am interested in how to add command / script / code at startup , I am using RPi 3 B+, with Pi OS Lite.
For example
ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up
I want to run this every time I power on rpi 3.
Thank you in advance.
Related
I'm able to ssh into pi from MacOS using ssh pi#raspberrypi.local or ssh pi#ip_address. I have been doing this for a long period of time. Now I installed Manjaro Linux along with the MacOS but I can't ssh in pi from Manjaro. ssh pi#raspberrypi.local returns name not found error while the other command times out. Works as expected when I switch back to MacOS. I've been stuck on this for a while now, I've tried multiple solutions but nothing seem to work. I have also tried re-installing and starting sshd but no luck.
You should check the information of /var/log/message on Raspberry PI, where the problem has been checked
The problem was in the Network adapter driver. If you are facing this problem check which driver are you using. If it is anything other than the Broadcom driver delete it and install the Broadcom driver and should work fine.
I am trying to get the Bluetooth to work in Raspberry Pi 3.
I am using buildroot with:
BlueZ 5.45 ( changed the package to get the latest)
Not using systemd, but I run bluetoothd because
the bluez script is for systemd.
In buildroot I enabled the bt firmware.
I can see the hci_uart.ko file and the Bluetooth firmware hcd file
I removed the console=ttyAMA0,115200 from cmdline.txt
I added rfkill for busybox but I only see the wifi interface, no Bluetooth interface.
running:
hciattach /dev/ttyAMA0 bcm43xx 921600 noflow -
output showed:
bcm43xx_init
Initialization timed out
tried 115200, the same.
Notes:
When using BlueZ 3 I am getting invalid id
I read that it is somehow related to BlueZ version so I did take the latest
All the above was taken after deep search.
So what I am missing here?
How can I get the Bluetooth to start running in my Raspberry Pi 3
with buildroot as image creator?
Thank you all!
The main problem is that buildroot adds the pi3-miniuart-bt overlay
in config.txt.
To remove it we need to remove if from the post-image.sh script as parameter to the above script.
In raspberry pi 3 the ttyAMA0 was assigned to bluetooth and the pi3-miniuart-bt restored it back to be serial com port, which disconnects the bluetooth again.
To summarize the steps in buildroot.
Add the bluetooth firmware.
Add bluez 5 utils.
Change the package from bluez 5.44 to 5.45
Add the above sleep. (delete the .stamp_build in bluez to build it again)
remove the /dev/ttyAMA0 from cmdline.txt
After building, check on the target (pi3)
the BCM4343 hcd firmware
hci_uart.ko should be there
hci_uart is not running in case of busybox init (only in systemd)
so just modprobe hci_uart. run lsmod to see that it is running.
To start the service and load the firmware, use hciattach:
hciattach /dev/ttyAMA0 bcm43xx 921600 noflow -
Start the bluetoothd daemon:
/usr/libexec/bluetooth/bluetoothd &
Power up the bluetooth hardware using bluetoothctl (power on and agent on).
Now you should see it using hcitool dev.
Again, if you don't remove the overlay you will get timeout.
That it. the hci device should be seen now.
you can see it using:
rfkill list ( install it from busybox-menuconfig)
hciconfig -a
The above steps does not get the console to work properly on the Pi 3 but this is a different story.
As described in the commit adding the firmware, you unfortunately need to patch bluez5_utils to get the firmware to work:
https://git.buildroot.net/buildroot/commit/?id=1f94f1aaab2e786542a83327358570a828d68f45
I want to scan networks when our devices is in Access Point. When the device is in client mode, it works, but i cannot scan networks if hostapd is running as Access Point:
Try 1:
pi $ sudo iwlist wlan0 scan
wlan0 Interface doesn't support scanning : Operation not supported
Try 2:
pi $ sudo iw dev wlan0 scan
command failed: Operation not supported (-95)
Any ideas?
On Raspberry PI/wheezy, you may need to get the libnl library:
apt-get install libnl-dev
I had the same problem. So I added ap-force to the command:
sudo iw dev wlan0 scan ap-force
and that worked for me.
SOLUTION:
Download iw v4.X from:
https://kernel.org/pub/software/network/iw/
Compile it and run:
./iw dev wlan0 scan ap-force
it works!
I am running Ubuntu Trusty 14.04 on a Raspberry Pi 2 Model B. The image for the Ubuntu install can be found here.
According to the image after installing linux-firmware it should be able to connect to the wifi. However the image is pretty bare and doesn't come with much. I installed wpa-supplicant and placed this code in the wpa-supplicant.conf file
ctrl_interface=DIR=/ver/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="RECUV-VICON"
scan_ssid=1
psk="fluffyapple617"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
And placed this code in /etc/network/interfaces
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-driver wext
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
When I do ifup wlan0 followed by ifdown wlan0 and another ifup wlan0 it displays
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to connect to non-global ctrl_ifname: wlan0 error: No such file or directory
There is a very similar thread that I found on this issue here. According to the solutions it just requires the correct driver for the adapter. Typing lsusb results in listing the device as such
Bus 001 Device 008: ID 148f:3572 Ralink Technology, Corp. RT3572 Wireless Adapter.
I searched for the exact linux drivers for Ralink wifi adapters and ended up here.
I added the components to my sources.list and it didn't install right away because several of the files conflict with the initial linux firmware so I needed to force override them. However it properly installed afterwards.
I know that the wifi adapter works, works with ubuntu, and works with the Pi itself. I tested it on my laptop running Ubuntu 14.04 trusty and it was able to connect. I also tried the Ubuntu Mate image on the Pi and the wifi adapter was also able to connect.
What am I missing or is there another error preventing this?
I have just started with my Raspberry Pi and I have a project where I want to read data from the USB port. I have installed Java JDK8 and written the program that compiles and run. But I get the message that /dev/ttyUSB1 does not exist.
I just have a cable from the USB port on the Arduino going to the USB port on the RPi and I am using Raspbian Debian Wheezy
When I go to DIR /dev/ and use $ ls, I can only find tty0 up to tty63. I have searched on the internet and some say that you can use ttyAMA0, but this does not work. I have also searched for the same problem, but have not found a answer to my problem.
I have used $ lsusb which gave me 4 devices (001-004) on Bus 001. I can see that, for example, my USB keyboard is listed as Bus 001 Device 004: ID 1532:010b Razer USA, Ltd.
and if I run $ dmesg | grep Manufacturer I get that:
[xxxxxxxxx] usb 1-1.2: Manufacturer: Razer
So my question is why does my usb devices not get listed as ttyUSB[id]? Do I have to manually attach it?
I am a bit noob when it comes to Linux.
Hope someone can help me!
I have some bad news for you. The reason you have no /dev/ttyUSB[n] devices on the RPi (when you connect your Arduino) is because you need the Arduino drivers (FTDI drivers in particular). The unfortunate thing is that these drivers don't yet exist for the Arm platform (which includes the RPi). This is according to the FTDI web page showing support. Note the lack of Linux driver support for Arm.
Apparently on Arm running Linux the only way to program the Arduino is via the serial port interface directly via the GPIO pins. Information on doing this can be found here . You will also have to do something similar on the Arduino side see this information.
Once you have the two devices connected via straight serial then your going to probably run into another SNAFU. By default apparently on the RPi Linux will use the serial port for sending debug/console output. In order to use the serial interface for something that behavior has to be modified. This article discusses that. In particular disabling the kernel from using the serial port for terminal use this would seem to apply:
The following steps (based on a clean 2012-07-15-wheezy-raspbian install
Open a terminal on the Raspberry, or connect to Raspberry Pi through SSH.
Make a backup of the /boot/cmdline.txt file.
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
Edit /boot/cmdline.txt file:
sudo vi /boot/cmdline.txt
This file contains:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $
Remove the parameters that reference the UART serial port (ttyAMA0):
dwc_otg.lpm_enable=0 console=tty1 $
Comment next line in /etc/inittab:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Reboot Raspberry Pi
sudo reboot
If you use a different Linux distro than Debian it would be different but the basics would still apply (modifying the kernel command line)