Reboot from controller script

Ask questions regarding Gentoox, Gentoo and Linux in general in these forums and we'll do our best to help you!
Post Reply
DBordello
Newbie
Posts: 6
Joined: Wed Jun 22, 2005 5:43 am

Reboot from controller script

Post by DBordello » Wed Jun 22, 2005 5:57 am

Hello,

My xbox does not have a keyboard or mouse hooked to it. So when ever I want to play games I need to ssh into it and reboot it. So, to alieviate this problem I wrote a simple script that reboots gentoox when i push L,R,Back,Start (look familiar?). My first thought was that the bios would catch this and reboot (without shuting down) but it doesn't.

Unfortunetly if you want to use this script it is going to be a PITA, i didn't make a pretty ebuild for you.

http://netfiles.uiuc.edu/dborello/www/xpadreboot.pl

To install it (as root):

1. cd /usr/bin; wget http://netfiles.uiuc.edu/dborello/www/xpadreboot.pl
2. It needs a module called Linux::Input::Joystick. There is no ebuild for this.
2a. perl -MCPAN -e shell
2b. Answer no to question about setup.
2c. "install Linux::Input::Joystick" Follow directions. If it fails the first time try again.
3. echo "/usr/bin/xpadreboot.pl & 1> /dev/null 2> /dev/null" >> /etc/conf.d/local.start
4. /etc/init.d/local restart

Enjoy :)
-dan

ps. It only works from the 1st controller port and it has to be plugged in on bootup (i think). I got too lazy to make it work on all contoller ports and I always have a controller in port 1.
[/url]

User avatar
clpalmer
Power user
Posts: 288
Joined: Sat Jan 29, 2005 6:38 pm

Post by clpalmer » Wed Jun 22, 2005 2:41 pm

doesn't that script suck up a lot of cpu time whizzing around in that while loop? I'm not sure the units on the polling delay, but even as seconds, isn't 10ms fairly short to be looping this on?

DBordello
Newbie
Posts: 6
Joined: Wed Jun 22, 2005 5:43 am

Post by DBordello » Wed Jun 22, 2005 8:14 pm

I thought the same thing as you at first. I have had it running for about 12 hours at it has used 0 cpu time.

Xbox root # ps x |grep perl
1563 ? S 0:00 /usr/bin/perl -w /usr/bin/xpadreboot.pl

Xbox root # uptime
21:13:30 up 14:28, 1 user, load average: 0.00, 0.00, 0.00

My cpu is running mostly idle and the script never shows up on top as using cpu ussage.

I guess I could shorten it (I planned to but forgot). Oh well.

If intrested I could clean it up (ie, watch all controller ports) and it could be included in the distro. I find it very useful.

dan

User avatar
clpalmer
Power user
Posts: 288
Joined: Sat Jan 29, 2005 6:38 pm

Post by clpalmer » Thu Jun 23, 2005 3:48 pm

Must be in the way the polling is implemented. Cool =) I might use this. I'm lookin for a way to shut down the damn thing without having to SSH in. Problem is, I never have a controller connected to it, so I'd have to tinker with it a bit to make it work when I plug in a controller. Maybe if it doesn't detect a controller, it can sleep for 10 seconds and try again or something. Hopefully gentoox now likes this bloody madcatz controller I have. Haven't tried it in ages, but it didn't work back when I did.

DBordello
Newbie
Posts: 6
Joined: Wed Jun 22, 2005 5:43 am

Post by DBordello » Thu Jun 23, 2005 7:04 pm

That shouldn't be too hard to do. When I get some time later today I'll get that put in.

-dan

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests