Page 1 of 1

PHP application with keyboard input

Posted: Wed May 28, 2014 1:21 pm
by YouAintTheHost
I wrote a small PHP application that accepts input from a USB keyboard. I want to run this application as soon as the PI boots up. I have put the application in inittab... however, it appears as though the screen that has control of the keyboard is the login screen.

Is it possible to not login, and have my application accept keyboard input while the system is NOT logged in?

Re: PHP application with keyboard input

Posted: Wed May 28, 2014 3:21 pm
by atomic3
PHP is a web server language and is executed when you visit that certain PHP page.

Or am I missing something?

php files should reside in /var/www or wherever your server is configured. The files are accessed through your browser.

Re: PHP application with keyboard input

Posted: Wed May 28, 2014 3:29 pm
by ghans
You can use PHP from the command line , just like perl/python/ruby/whatever ..

ghans

Re: PHP application with keyboard input

Posted: Wed May 28, 2014 5:08 pm
by YouAintTheHost
Indeed... yes, I am using PHP as a command line tool. It also spawns off a couple different python scripts in order for the system to do what I want.

However, the important piece to me as it stands is having the application start up through inittab at the start, and have complete control over the keyboard input (I am using the stdin to retrieve the input from the keyboard). As i mentioned though, the login screen seems to have control of the keyboard when the system starts up. I want my PHP script to have control of stdin instead.

Is it a problem of timing (since inittab starts my process first, the login screen starts after that, and has control?).

Re: PHP application with keyboard input

Posted: Wed May 28, 2014 5:31 pm
by riklaunim
Maybe you should take over specific USB device (the keyboard) and not stdin? pyusb can do that.