LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices

Reply
 
Search this Thread
Old 02-11-2014, 02:48 AM   #1
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Rep: Reputation: 9
Initiating shutdown from a button press


I've been able to somewhat salvage the tablet my son broke the screen on by making it into a headless machine running (an OS pertinent to the subform this has been posted on: Slackware ARM).
The device only has 3 physical buttons: PWR, VOL+ and VOL-

Can I avoid having to access the machine via ssh to have it shutdown properly ?
Can I have it shutdown properly by pressing the power button ?

Last edited by louigi600; 02-12-2014 at 03:18 PM. Reason: I keep on getting answers not relavent to Slackware
 
Old 02-11-2014, 11:33 AM   #2
sgosnell
Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 425

Rep: Reputation: 73
You should be able to shut it down by pressing and holding the power button. That's the usual way to shut down a tablet or smartphone. If you've installed a different OS on the tablet, then you will need to check the documentation for that OS, but it should continue to work as before.
 
Old 02-11-2014, 12:03 PM   #3
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
The press and hold is equivalent to a hard power-off I'm looking for proper shutdown.
Slackware ARM has no official support for that hardware ... in any case this is the right subform to ask Slackware ARM community if anyone knows how to go about it ... maybe someone knows how android detects the vol,power,home,menu and exit buttons being pressed ... so maybe it's also usable on Slackware ARM.

I was looking at both dmes and messages while fiddling with the buttons but there was nothing detected.
On acpi systems things show up when you start pressing unhandled buttons ... I remember customizing acpi actions on my eeepc by looking at dmesg and by using logger as action in the acpi handler script to show me what was going on ... but I think that it's not applicable on ARM.
Could it be that I need to check some gpio pin status ?

Last edited by louigi600; 02-11-2014 at 12:49 PM.
 
Old 02-12-2014, 10:41 AM   #4
sgosnell
Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 425

Rep: Reputation: 73
On the tablets I've owned, a quick press of the power button turns off the screen. Pressing and holding for about 2 seconds gives a menu to shut down, reboot, and some other choices. You have to hold the power button for 10 seconds or more for a complete hard shutdown. That said, I have no idea how Slackware or any other Linux distro would interpret any of the power keypresses.
 
Old 02-12-2014, 03:14 PM   #5
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
Maybe my initial post or the subject are a bit too vague ... anyway the screen is broken, the tablet is running slackware ARM 14.0 headless.
 
Old 02-12-2014, 06:50 PM   #6
sgosnell
Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 425

Rep: Reputation: 73
I was aware of the situation. As I said, I don't know how the interpretation of the power button presses is done in Linux. It may be done by the kernel, and you might have to jump through some hoops to get it working. But Android uses a Linux kernel, so it should be possible. In Android, there are three possible actions of the power button - short, medium, and long duration. The medium duration press should initiate shutdown, one way or another. Getting that menu to appear may be difficult, though. I really don't know where else to point you.
 
Old 10-05-2014, 08:37 PM   #7
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
While doing some research I came across this. I found the section about JACK Soc Architecture particularly interesting:
Quote:
The mainline kernel prefers another approach, using our beloved Jack SoC architecture. It also provides a convenient way of reporting button pushes, which is quite nice.
I've been searching for information about this ans apparently the status of the switches can be read in
/proc/asound/card0/codec#0
in the "Pin-ctls:" sections.
but that only holds true on x86 ... anyone know where to get this info on arm devices ?

Last edited by louigi600; 10-07-2014 at 05:31 PM.
 
Old 10-10-2014, 01:58 AM   #8
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackware ARM, Salix and Porteus
Posts: 567

Rep: Reputation: 45
I'm just guessing, however, the first thing I'd try would be using using [find] to see what if any file has changed in /proc after a button has been pressed or is being continuously pressed. I use a while loop a check if a gpio pin on my pi's goes low and if so then [shutdown -h now] is run. You could probably do the same if [find] can identify which file in /proc changes when a given button is pushed. Wouldn't matter which button, just which file. I once did a similar thing with my daughter's computer. Check the mouse status in /proc/interrupts if the mouse hasn't moved in a given period of time and she isn't watching a video, shut the box down.
 
Old 10-10-2014, 02:48 AM   #9
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
Hum ... I don't think that works because also inotify fails to detect the changes on x86 when /proc/asound/card0/codec#0 changes. I'm not sure if it's a bug or something one should expect because /proc is not a real filesystem ... whatever if inotify does not detect change I doubt find will do either ... but I can give it a go anyway

Yeah the gpio thing would be my next try ... but on the xzpad700 there are no spare pons for GPIO: I'd haveto sacrifice CSI or LVDS but that's no big deal since the lcd is bust (thatnks to my son). But if it's possible to the the buttons that are already wired up to work it would really be the best thing.
 
Old 10-10-2014, 03:19 AM   #10
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackware ARM, Salix and Porteus
Posts: 567

Rep: Reputation: 45
Quote:
Hum ... I don't think that works because also inotify fails to detect the changes on x86 when /proc/asound/card0/codec#0 changes.
Might be, and also volume controls might be attached to something on the board instead of interfacing with the system.

I don't know how often you'd be shutting it down so this might not be practical. Does that thing have a usb port? If so you could script the shutdown to be based on something being plugged in. Parse for a given device/hex number. I'd do that before I'd start playing with gpio pins.
 
Old 10-10-2014, 04:06 AM   #11
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
Quote:
Might be, and also volume controls might be attached to something on the board instead of interfacing with the system
Whatever the buttons are attached to android manages the press events via h2r ... there must be a way on mainstream Linux too (just don't know how impervious the route may be).

Quote:
Does that thing have a usb port? If so you could script the shutdown to be based on something being plugged in. Parse for a given device/hex number. I'd do that before I'd start playing with gpio pins
The USB thing could probably be done all via udev without having to make any scripts or code ... but having lost the display it's going to do some sort of headless appliance job and it will probably use it's only USB port so it's a no go for me.
I just want a handy way to turn the thing off without crashing it or having to login to it. I might end up having it mounted readonly and not caring about crashing it (just like my dockstars).
 
Old 10-10-2014, 05:24 AM   #12
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackware ARM, Salix and Porteus
Posts: 567

Rep: Reputation: 45
Ok, I see, only one usb port and its in use and ssh undesirable. I thought about udev but didn't want to go there. Without something to play with I'm no help but its a nice problem. If you start playing with the gpio pins watch out for the magic smoke.

Cheers!
 
Old 10-16-2014, 04:12 PM   #13
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.16.2
Posts: 1,568
Blog Entries: 13

Rep: Reputation: 181Reputation: 181
Just an idea: I noticed that quite a few A10 support patches have been added to the kernel since kernel 3.10; perhaps compiling the latest version might have support for the button pushes.
 
Old 10-17-2014, 05:58 AM   #14
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by mostlyharmless View Post
Just an idea: I noticed that quite a few A10 support patches have been added to the kernel since kernel 3.10; perhaps compiling the latest version might have support for the button pushes.
Interesting thing but I think that there is a lot of stuff that is not making it to mainstream from linux-sunxi kernel.
I'm not sure what's making it and what not but it may be possible that mainstream kernel might be functional for headless systems: anyone had a go at using mainstream kernel on Allwinner SOC based systems ?
 
Old 10-20-2014, 04:39 PM   #15
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 217

Original Poster
Rep: Reputation: 9
It appears that on my device the buttons ate interfaced via I2C ...
Code:
[pmu_para]
pmu_used = 1
pmu_twi_addr = 52
pmu_twi_id = 0
But I can't dump the status because 0x34 is in use
Code:
root@headless2:~# i2cdump -y 0 0x34
No size specified (using byte-data access)
Error: Could not set address to 0x34: Device or resource busy
root@headless2:~#
If it's in use it's I may just haveto find the right place in /sys to read the button status.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Xlib: Get next Button Press on the display hydraMax Programming 3 01-10-2012 11:14 AM
Turn the power button into a key press? jsteel Linux - General 2 04-21-2011 02:47 AM
i hv to manually press the power button on shutdown after all daemons have been stopp alice_neo Linux - Software 6 09-12-2007 03:55 PM
disable shutdown by press the power button nickraj General 8 03-03-2007 12:16 AM
I want my Controller to output text with button press timrs Linux - Games 9 01-08-2007 07:19 AM


All times are GMT -5. The time now is 08:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration