User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

(Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 6:20 pm

Hey guys,

This is very likely not the place to post this, but since you're a great community that isn't full of trolls I thought this is the most fitting place to ask this as it can also be used on a Pi.

So, a little backstory. I recently built a new PC with some old hardware I had (i5 2300 @2.8ghz + 8GB RAM), I decided to run Arch Linux on it after a friend recommended it. I gave it a go as I got fed up of Debian and I wanted something new. So the OS is great! But I had an Idea.

Since with Arch you can press CTRL + ALT + DEL to force a restart of the system and the fact that I'm VERY lazy. I wondered if it wouild be possible to get a button (Like this:)
Image
and attach a USB extension to it and have it work so that when pressed it would send CTRL + ALT + DEL to the pc which is the other end of my room.

I appreciate that my little ghetto project may be vague in the details, but I'd like to do it as it'd make my setup personal and functional at the same time.

Thank you for your time :)
Shadow<3

HankB
Posts: 127
Joined: Fri Jan 01, 2016 2:45 pm

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 6:30 pm

I think you could, but it would require making a button that would behave like a USB input device. I'm not sure that would be so easy.

It would be easy - bordering on trivial - to program a shutdown in response to pressing a button connected up to a couple of GPIO pins. If you search for GPIO and shutdown you will probably find some discussions.

HTH,
hank

User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 6:31 pm

It would be easy - bordering on trivial - to program a shutdown in response to pressing a button connected up to a couple of GPIO pins. If you search for GPIO and shutdown you will probably find some discussions.
Any ideas on how to do this on a Desktop hardware?
Shadow<3

User avatar
rpdom
Posts: 16127
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 6:36 pm

A crude method would be to rip the controller board out of a USB keyboard, hook relays or opto-isolators to the connections for the Ctrl, Alt and Del keys and wire the button so it triggers those when pressed.

You'll need to trace the circuit on the keyboard matrix to find which keys are which connections, but this sort of thing does work. I've used it to send a certain simple key sequence to a PC just after power up.

User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 6:37 pm

For a person that has never touched electronics in their life, how hard would that be?
Shadow<3

HankB
Posts: 127
Joined: Fri Jan 01, 2016 2:45 pm

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 9:51 pm

BlueShadow<3 wrote:
It would be easy - bordering on trivial - to program a shutdown in response to pressing a button connected up to a couple of GPIO pins. If you search for GPIO and shutdown you will probably find some discussions.
Any ideas on how to do this on a Desktop hardware?
Ahh... I didn't read carefully enough. (Words matter!) I thought you were asking about a Pi.

I think rpdom has that covered better than I could hope to. I searched for "hack digital input pc" and didn't see anything that looked relevant. I think there are ways to do that with a parallel port and perhaps even a serial port (status lines or break condition.) but those seem to have gone the way of the dodo.

User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 9:53 pm

No probs, I'll see what I can find on the glorious web. When I get it done I'll post pics for those who are actually interested to see :D

Thanks for the pointers guys! :D
Shadow<3

User avatar
morphy_richards
Posts: 1603
Joined: Mon Mar 05, 2012 3:26 pm
Location: Epping Forest
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Thu Mar 10, 2016 10:05 pm

Don't use USB, use Ethernet.
Or alternatively use USB, get a pi zero attached to it in Ethernet device mode.
Either way, get a raspberry pi on the same network with the button attached to it's gpio.
When you press the button have it run a script to SSH into your Arch system with a restart command.

User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Fri Mar 11, 2016 5:14 pm

Could do, but I don't want to involve a Pi if I can get away with it. I just want the button to send the restart command.
Shadow<3

User avatar
Douglas6
Posts: 4812
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Fri Mar 11, 2016 5:43 pm

If you want to create a USB HID device, you'll need a processor of some sort. Could be a Pi, could be an Arduino, could be a hacked keyboard. Something.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Fri Mar 11, 2016 6:09 pm

BlueShadow<3 wrote: and attach a USB extension to it and have it work so that when pressed it would send CTRL + ALT + DEL to the pc which is the other end of my room.
Surely sending those keys in concert is not the only way to effect a shutdown. Programmatically other ways such as "shutdown now" might be better.
I don't want to involve a Pi if I can get away with it. I just want the button to send the restart command.
But how does the restart sequence get into your computer? The idea that you could program the guts of a USB keyboard that had a long enough cable and was attached to your machine as a secondary keyboard is perhaps one possible way.

Given the key combinations, you might be able to just lock the keys on somehow and then when you push the button, it brings the usb and keyboard interface up. You could test this by having someone hold the three keys down and then plugging in the keyboard. Does Arch reboot?

The next step would be to figure out how to wire this up without destroying your computer. How is the USB interface designed at start up, I mean for hot swap plug and play? Some systems have contacts that connect earlier, such as the ground connects first, then the power and finally the data and other lines. I don't know if that's true with USB, I can't see inside this flash drive. In looking at this sdcard and this micro sdcard, it is clear that the connectors are of different lengths. So if this matters, you wouldn't want to defeat these efforts in your design.

But I wouldn't do this because paying for a 30 foot USB cord will defeat your reason for not using the pi, if it's that you don't want to spend the $35. This is a perfect use case for the pi zero though, you'd find a USB bluetooth or wifi dongle and have a button and it sends out a signal to the arch box and reboots it using a script. Way cooler than dragging around the cord although you'd need batteries.

User avatar
BlueShadow<3
Posts: 40
Joined: Tue Oct 07, 2014 4:51 pm
Location: Herefordshire, England
Contact: Website

Re: (Possibly Unrelated) Arch Linux and CTRL + ALT + DEL

Fri Mar 11, 2016 6:17 pm

Alright, thanks man :)
Shadow<3

Return to “General discussion”