How can I reset libcec / HDMI settings on raspberry pi? - linux

Recently I was experimenting with controlling my Raspberry Pi's HDMI screen using libcec. I made a few settings changes (which regrettably I didn't keep track of), and when I re-booted the Pi, I got a blank screen.
This now happens every time I boot the Pi normally. I see a few boot messages and then the screen abruptly goes black (before I'm given the option of logging in). The only way I can access the command line is if I add "init=/bin/sh" to cmdline.txt.
What I'd like to do is undo the changes and return the Pi's HDMI settings back to normal. Is there a simple way to do a total reset of libcec / cec-client? Do I need to uninstall libcec? If so, how do I do that?

Related

Rasberry Pi - Start a SCREEN session then attach to it, so its displayed on the HDMI output

I can write a startup script that can start a screen session, however I couldn't find a guide, for starting the screen session, then attach to it, like so the particular screen session is displayed on the HDMI output after startup.
Is this possible? If so, how?

When you plug in a HDMI after booting of a Raspberry Pi 4, you get the display but not the audio

When HDMI cable is pluggwd in at the boot time, the Rasp Pi 4 display comes up normally and audio plays. (One can check by right clicking on the audio icon on the menu bar, to see the device profile in which HDMI is selected by default.)
Now even if you remove the HDMI cable and then replug it in, you will get back the normal display and the audio
However, if you boot up the Rasp Pi and plug in the HDMI cable later on, the display will come up but the audio will be missing. Right clicking on the audio icon of the Menu bar will reveal that HDMI is itself missing in the device profile.
I have tried out all permutation/ combinatioms of HDMI in the /boot/config.txt, but that doesn't help.
My Pi is normally supposed to be used as a Hotspot, but as an option, one can plug in a HDMI monitor anytime. Rebooting shouldn't be required to get the audio.
Note that there is, of course, no problem if there was a switched-off HDMI monitor connected at the boot time, Whenever one switches the monitor on, the display and the audio will be back.
The missing audio problem comes only when you connecr a HDMI monitor, later on.
After extensive trying out with the help from the raspberry pi forum (https://forums.raspberrypi.com/viewtopic.php?t=343523 ) following is the solution which works well.
In /etc/udev/rules.d/99-HDMICallback.sh keep this rule
KERNEL=="card?", SUBSYSTEM=="drm", ACTION=="change", RUN+="/home/pi/HDMICallback.sh"
In HDMICallback.sh keep this shell code
HDMIDetect(){
systemctl --user stop pulseaudio.service
systemctl --user stop pulseaudio.socket
pulseaudio --start
touch /tmp/HDMI.pr
}
export -f HDMIDetect
[ ! -f /tmp/HDMI.pr ] && [ "$(cat /sys/class/drm/card?-HDMI-A-1/status)" == "connected" ] && su pi -c "bash -c HDMIDetect"
Essentially the pulseaudio has to be stopped and then restarted, when the HDMI plugin triggers the HDMICalback.sh.
Once the pulseaudio has been started, then the same doesn't have to be done, on subsequent HDMI plugouts and plugins - hence the /tmp/HDMI.pr variable.
Unlike a PC, Raspberry PI can be started without a HDMI Monitor attached, perhaps for serving in a headless way or with a hnotspot. At any point an HDMI monitor can be attached with the display and audio coming up immediately.

Can't log in to embedded Linux Buildroot

I'm looking to install Linux onto an Intel Galileo Gen 2 utilizing this and this via installing onto an SD card.
I believe I have successfully done this, as during the boot sequence I am able to select Linux to boot from, however as soon as it starts booting from Linux, I am unable to interact with the Galileo anymore by say typing in my username and password when it comes time to login.
I'm unsure if my peripheral setup is wrong, if I need to install some more drivers to support I/O or something else.
I am viewing the logs from the Galileo via an FTDI cable and currently have a keyboard plugged directly into the Galileo.
Log data
When I boot the Galileo, this is what is logged.
Interestingly, the
flashing cursor stops flashing and is just steady when I get to the
login screen, as if the device is sort of frozen
However if I then
say connect a keyboard, it recognizes it and outputs this log data.
Solved! Turns out it was a faulty FTDI cable!

weird characters displayed during serial communication OSX

I have tried communicating via serial (OSX w/ prolific drivers -> USB RS232 adapter -> Tx,Rx and GND pins on device serial ttl port) to a device and done so successfully using
screen /dev/tty.usbserial 115200 8N1
I get to log in and use it as if I was SSH or TelNetted in...
However whenever I try to go into system recovery mode (holding CTRL+1) while the device is powering on, it starts displaying weird characters and until I close the screen session it will continue showing weird characters:
Of course when we tried doing the same thing on my boss' macbook running windows and PuTTY and everything worked fine, even in system recovery mode; characters were displayed properly.
What gives? Id like to learn the intuition to use because up till now I concluded that since I can bot into the system and see characters normally everything about the connection should be fine and its must have been the recovery partition that was broken. This was wrong of course...
Niko
Dunno if it is a OSX problem,
I had similar problems before. I fixed it either by changing the Baud rate of the com ports or by making sure the Ground on the circuit is the same as the ground of the supply.

Makes changes to asound.conf effective without restarting services?

I am running a mopidy based spotify player on a raspberry pi - my goal is to utilise both the onboard analog audio as well as an external USB sound card, with a different set of speakers in different rooms plugged into each, creating a multi room system.
The key is to be able to switch / redirect audio on the fly ie without rebooting, stopping music.
This is the closest I have gotten:
sudo nano /etc/asound.conf
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
change card from 0 (onboard analog) to 1 (external usb)
then
killall -9 mopidy
/opt/startmopidy.sh
This does the job but killing mopidy stops the music (and editing asound.conf doesn't have a high WAF!) but i cant get the setting to take effect without reloading mopidy.
Someone suggested I try Pulse Audio instead of ALSA but before I do want to see if I can find a method using ALSA....suggestions??
ALSA does not allow changing the hardware device without actually opening the other device, which would require support by the application.
You need PulseAudio for that.

Resources