Pi install

From: graphitone22 Aug 2018 07:45
To: ALL12 of 92
I did a wrong. :C

Somehow I've lost all sound. Instead of arseing about trying to put the config right, I'm going to wipe the SD card and start again and put what I know works in, make a backup (!) and then troubleshoot it.
From: ANT_THOMAS22 Aug 2018 08:39
To: graphitone 13 of 92
Do you know how to make a backup image of an SD?

Very useful to have at least a basic configured image to go back to if you do a wrong.
From: CHYRON (DSMITHHFX)22 Aug 2018 13:18
To: ANT_THOMAS 14 of 92
I did exactly that to quickly recover from a botched xfce install using fsarchiver. Dunno if that works on an sd card, I've never backed one up.
From: graphitone22 Aug 2018 13:21
To: ANT_THOMAS 15 of 92
Aye, I'm gonna get a base setup and make an image - don't really know why I didn't do it the first time round. :C
From: ANT_THOMAS22 Aug 2018 14:07
To: CHYRON (DSMITHHFX) 16 of 92
The method I use is a bit crude but works surprisingly well.
I use "dd" to clone the SD card location (something like /dev/mmblock0) to a network location.

Works on a running system which is nice. You can even run the command through gzip to compress the free space and shrink the storage required for the image. Slows the process down though. Requires a same or larger size SD to restore.
From: CHYRON (DSMITHHFX)22 Aug 2018 14:28
To: ANT_THOMAS 17 of 92
Ah. I was going to suggest the "dd" method but didn't know if it worked on sd cards.
From: ANT_THOMAS22 Aug 2018 14:56
To: CHYRON (DSMITHHFX) 18 of 92
The good old fear of getting if and of the wrong way round
From: CHYRON (DSMITHHFX)22 Aug 2018 15:04
To: ANT_THOMAS 19 of 92
 :-&
From: Chris (CHRISSS)22 Aug 2018 18:06
To: ALL20 of 92
Sounds like a really good project. I look forward to seeing the results of it all.
From: CHYRON (DSMITHHFX)22 Aug 2018 18:29
To: Chris (CHRISSS) 21 of 92
Here's a preview:

From: graphitone22 Aug 2018 19:45
To: CHYRON (DSMITHHFX) 22 of 92
(fail)
From: graphitone22 Aug 2018 20:44
To: All 23 of 92
Ok, this portion of the script works really well, (thank you PB!)
 
Code: 
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)


oldButtonState1 = True


while True:

    #grab the current button state
    buttonState1 = GPIO.input(5)


    # check to see if button has been pushed

    if buttonState1 != oldButtonState1 and buttonState1 == False:

        subprocess.call("echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now", shell=True,

            stdout=subprocess.PIPE, stderr=subprocess.PIPE)

        oldButtonState1 = buttonState1



        time.sleep(.1)

On a click of the button it turns off the backlight and shuts the Pi down. I only need that one line as it automatically turns the backlight back on on a power up. However, although it was working initially on a rebuild, the sound's dropped off again. :C
From: CHYRON (DSMITHHFX)22 Aug 2018 21:05
To: graphitone 24 of 92
No? How about this:

From: graphitone22 Aug 2018 21:13
To: CHYRON (DSMITHHFX) 25 of 92
What you doing taking pictures of Throb's living room?
From: Peter (BOUGHTONP)22 Aug 2018 22:10
To: graphitone 26 of 92
"Somehow I've lost all sound"

My sound broke in Arch by doing something that buggered around with PulseAudio, which then fucked up ALSA, because PulseAudio is a buggy bloated piece of shit that nobody actually needs.

So maybe you installed/upgraded (possibly automatically) something that did fiddled with PA?

From: Peter (BOUGHTONP)22 Aug 2018 22:45
To: graphitone 27 of 92
You're still using the "Are we there yet? Are we there yet? ..." method instead of the "Tell me when we're there" one.

If you do really want to do it this way, since you only care about shutdown, you don't need to store/check oldButtonState and can simplify it to:

GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# endless loop until button is pressed
while GPIO.input(5):
	time.sleep(.1)

# verify button state before switching off
if not GPIO.input(5):
	subprocess.call("echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now",
		shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE)

The if verification is probably not necessary (depending on how Python works), but even so it acts as both a safety against unwanted shutdown (incase something goes wrong), and clarifies the intent slightly. (The event-driven/callback method would make it even clearer.)

From: Chris (CHRISSS)22 Aug 2018 22:54
To: CHYRON (DSMITHHFX) 28 of 92
:D
From: CHYRON (DSMITHHFX)23 Aug 2018 01:17
To: graphitone 29 of 92
Has he really got a 70s stereo system?
From: graphitone23 Aug 2018 09:33
To: Peter (BOUGHTONP) 30 of 92
Could well be.

IQaudIO produce this document (a pdf download) which seems to be wrriten in multiple styles and changes between being helpful and downright confusing.

I'll check the onboard audio is properly disabled and might go back to a vanilla image, and test the sound after every change made.

 
From: graphitone23 Aug 2018 09:36
To: Peter (BOUGHTONP) 31 of 92
Quote: 
You're still using the "Are we there yet? Are we there yet? ..." method instead of the "Tell me when we're there"



Other than being more optimised (and I appreciate the arguments for non-bloated code) does that have a knock on effect on real world performance or not?

Thanks for the suggestions though, I'll try that once I get the sound working again!.