Raspbian echo device - echo

I need to create an echo device for software tests under Raspbian.
The aim is a device, that returns everything. E.g. if I would send some data to a device (ls > /dev/tty30), I need this data back from this (or an equal) device.
Is there already a possibility out-of-the-shelf inside Raspian? (e.g. an echo device)
Can I create such a device by an serial null modem simulation?

Raspbian sure supports such behaviour:
root#raspberrypi:/root# mkfifo /dev/tty100
root#raspberrypi:/root# cat < /dev/tty100 |cat > /dev/tty100&
[1] 19024
root#raspberrypi:/root# echo hi > /dev/tty100
root#raspberrypi:/root# cat /dev/tty100
hi
^C

Related

Raspberry Pi not picking up Wii controller or not communicating

I am trying to connect my Wii-mote's to my Raspberry Pi, so I can use them in pygame. I know to use the Wii controller, I need to make some configurations, and I have made them. However, when I run my .sh script to connect the remotes, I am thrown some errors. Here are the scripts:
/mywinput
#WiiMote
Wiimote.A = BTN_A
Wiimote.B = BTN_B
Wiimote.Dpad.X = ABS_Y
Wiimote.Dpad.Y = -ABS_X
Wiimote.Minus = BTN_SELECT
Wiimote.Plus = BTN_START
Wiimote.Home = BTN_MODE
Wiimote.1 = BTN_X
Wiimote.2 = BTN_Y
# Nunchuk
Nunchuk.C = BTN_C
Nunchuk.Z = BTN_Z
Plugin.led.Led1 = 1
#Plugin.led.Led2 = 1
Plugin.led.Led3 = 1
#Plugin.led.Led4 = 1
/wiicontroller.sh
#!/bin/bash
sleep 1 # Wait until Bluetooth services are fully initialized
hcitool dev | grep hci >/dev/null
if test $? -eq 0 ; then
wminput -d -c /home/pi/mywinput CC:FB:65:2C:52:8F &
else
echo "Blue-tooth adapter not present!"
exit 1
fi
I have made wiicontoller.sh executable:
sudo chmod 775 /home/pi/bin/connectwii.sh
Supposedly, I should press one and two one the controller and it should connect. However, the script returns immediately. And even then, when I press one and two, I get thrown errors. I don't think that should be possible as the script has returned, but here is the output:
Socket connect error (control channel)
I am also aware that using cwiid in python is another option. But that doesn't work either, as it does not detect my remote. wmgui also cannot pickup my remote. The only way I am able to detect my remote is through the hcitool scan command. Any help would be appreciated!

Program and Run PIC18 with pickit4 on linux

I am on linux ubuntu and target is a PIC18F47J53.
I basically want to program the chip and then let it run, using command lines and using pickit4.
using ipecmd (from mplab x ide v5.45), this is my command:
/opt/microchip/mplabx/v5.45/sys/java/zulu8.40.0.25-ca-fx-jre8.0.222-linux_x64/bin/java -jar /opt/microchip/mplabx/v5.45/mplab_platform/mplab_ipe/ipecmd.jar -TPPK4 /P18F47J53 -M -F"/path_to_myfile.hex" -W
This is my output
DFP Version Used : PIC18F-J_DFP,1.4.41,Microchip
*****************************************************
Connecting to MPLAB PICkit 4...
Currently loaded versions:
Application version............00.06.66
Boot version...................01.00.00
Script version.................00.04.17
Script build number............db473af2f4
Tool pack version .............1.6.961
PICkit 4 is supplying power to the target (3.25 volts).
Target device PIC18F47J53 found.
Device Revision Id = 0x1
*****************************************************
Calculating memory ranges for operation...
Erasing...
The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
program memory: start address = 0x1fc00, end address = 0x1fff7
configuration memory
Programming/Verify complete
Program Report
30-Jan-2021, 12:54:41
Device Type:PIC18F47J53
Program Succeeded.
Operation Succeeded
All good, and takes about 12 seconds, however, after that the pickit4 turns off the power target, and the pickit LED is BLUE (I guess state "ready")
The main question is how can I let the pickit4 powering the boards? any specific parameter? (I cannot find on the readme.html)
If I use MPLAB X IPE GUI to program, the programming is much quicker (3 or 4 seconds), the pickit LED is YELLOW and the target is left powered on. (I selected "release from reset")
I have tried to get the log out with as many details as possible, but I cannot see the commands sent to the pickit4.
Any idea? thanks
I realize that it's been a while since you asked, but i put the answer here for anyone who needs it. Add -OL to your command line options.

Skylake hardware brightness changes too granular

I'm having a problem with Skylake i7-6700 HQ laptop display (HD 530 graphics) brightness changes:
If the value changes by 20 it works.
If the value changes by 19 it only works in multiple-hundred jumps.
If the value changes by <19 there is no brightness change at all.
However on my old Ivybridge laptop i7-3630 QM (HD 4000 graphics) brightness successfully changes in steps of 1.
Here is the script for testing:
#!/bin/bash
# Test all brightness levels from 1 to max_brightness
# For Intel i7-6700 HQ HD 530 graphics:
# - When change is 18 steps brighhness doesn't change at all.
# - When change is 19 steps brightnesss changes on multi-hundred point jumps.
# - When change is 20 steps each change applied as expected.
# For Intel i7-3630QM steps of 1 work fine!
if [[ $(id -u) != 0 ]]; then
echo >&2 "$0 must be called with sudo powers"
exit 1
fi
cd /sys/class/backlight/*/
max=$(cat max_brightness)
save=$(cat brightness)
for (( i=1; i < max; i=i+20)); do
echo $i > brightness
echo setting brightness level: $i
sleep .005
done
echo $save > brightness
echo resetting brightness level from $max back to: $save
exit 0
I think my skylake is working fine other than weird temperatures reported for pch_skylake sensor:
$ paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/...$/.0°C/'
INT3400 Thermal 20.0°C
SEN1 56.0°C
SEN2 52.0°C
SEN3 57.0°C
SEN4 61.0°C
pch_skylake -44.0°C
B0D4 50.0°C
x86_pkg_temp 52.0°C
Other than that Linux intel micro-code is definitely activated on old laptop (Ubuntu 16.04) but may not be loaded on new laptop (Ubuntu 16.04.5).
Edit: Rebooted with Ubuntu 18.04.1 LTS, Kernel 4.15.0-36 and the same behaviour is witnessed.
Confirmation: I wonder if others have a Skylake laptop and can confirm hardware brightness works the same way.
Question: For the app I'm developing, do I have to put in a feature for each user to test smallest granular brightness change supported?
Backlight brightness is separate from the GPU proper; the iGPU that's part of the CPU chip just produces pixel data for the LCD, e.g. as a DisplayPort output. (Or in laptops, often an eDP lower-voltage signal).
Note that in a desktop, you can't adjust the backlight brightness with software; there's no connection from the normal GPU hardware / drivers with the backlight.
The software backlight control in laptops is pretty much separate from the iGPU, and has nothing to do with whether it's a Skylake or IvyBridge. The backlight control is a separate hardware device with separate I/O ports (or memory-mapped IO registers or whatever).
Finer granularity backlight adjustment is a property of the laptop design, not the CPU. Specifically of the backlight technology and controller hardware.
(This is my understanding, but I haven't actually looked at GPU or backlight / ACPI driver code in enough detail to be 100% sure this is accurate.)
I have no idea if it's possible for software to query the true / meaningful granularity; this answer is only to point out the misconception that it's dependent on the GPU or GPU drivers.

iwlist scan shows empty ESSID (ESSID: "") on Pi 3 with Raspbian

On Pi 3 with Raspbian (clean install) when I run:
sudo iwlist scan | grep ESSID
I can get both normal outputs and outputs with empty ESSID. E.g.:
ESSID: "SomeNetwork"
ESSID: ""
The list does not contain some networks which I can see through the web interface on my laptop, so I guess they are shown as having empty name.
Does anyone have any idea what is going on here?
could be hidden ESSID Networks.
Here is the manual to connect to Hidden SSID
http://www.thehecklers.org/2015/02/27/how-to-connect-raspberry-pi-to-hidden-ssid/
Regards

inotifywait not detected in /sys/class/gpio/gpioXX/ (raspberry pi)

I have connected 2 raspberry pi using GPIO :
The first one is the master, and use GPIO2 (and GND...)
The second one is a slave, and use GPIO0 and GPIO1
All are switch on a relay card
I put GPIO1 and GPIO0 on direction "IN" and GPI02 on direction "out" :
echo in > /sys/class/gpio/gpioXX/direction
On my master, (GPIO2, direction = OUT), when i put the pin GPIO2 to 1, the 2 pins on my slave turn to 1 too. So, no probleme here
I add a shell script, using inotifywait on one folder (for example /sys/class/gpio/gpio18/ (18 for GPIO1)).
When I'm on my SLAVE, and i try to modify the value of /sys/class/gpio/gpio18/ with an echo 1 > .../value , inotifywait catch a modification, but the value didn't change ( -bash: echo: write error: Operation not permitted , it's normal because direction is on "IN" ).
When I'm on my MASTER, and i modify the value of gpio27 (corresponding to GPI02), both value file (GPIO0, GPIO1 and GPIO2) change, but my inotifywait didn't catch the modification on gpio/gpio18/value (the containt of the file change from 0 to 1 or inversely)
I can't say for sure what is wrong. But I would try running a simple script like this and see what happens:
while inotifywait -e modify /sys/class/gpio/gpio18/; do echo "Hello"; done