Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 28 Aug 2014, 07:26
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
test if ctrl or alt or shift is pressed
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Thu 26 May 2005, 23:50    Post subject:  test if ctrl or alt or shift is pressed  

i wrote a C program that tests if the ctrl or alt or shift keys are pressed

i thought it might be useful when Puppy was booting ... for example, hold the ctrl key and it will not use a pup001 file ... something like that

it has to run with root priviledges for it to work properly

Useage:

port60
if [ $? -eq 29 ];then
# do something
fi
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Fri 27 May 2005, 00:28    Post subject: Brilliant  

This should solve all the 'simple' versus 'boot up options'. With Puppy you can have your cake and all the trimmings.

Press Ctrl for extended boot options in small letters bottom right of the splash screen - see splash screens are useful.

Good job G2

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Fri 27 May 2005, 01:18    Post subject:  

i don't know how well it will work
it wouldn't allow you to pass boot options to the kernel, like noacpi
if it works well enough, it might be useful though

C doesn't seem to have a simple way to check if certain keys are pressed

i tried writing a few nasm programs ... the kernel doesn't let you access the ports directly ... maybe it would if you called ioperm, but if you do that, you might as well write the whole program in C

maybe there's an easier way, i am not a C expert
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Fri 27 May 2005, 08:42    Post subject:  

GuestToo,
Thanks for that, I think it may have its uses...

for example, as we haven't solved the first-boot problem with multisession, holding down one of those keys could be the way to tell Puppy to bootup as multisession.
Back to top
View user's profile Send private message Visit poster's website 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Fri 27 May 2005, 16:10    Post subject:  

this is just the first thing i got to work

this program reads port 60 directly ... which is the ps2 port ... so this probably won't work for usb keyboards

i think a more straight-forward approach would be better ... C doesn't seem to have a simple way of checking keys ... there is getchar, but that stops and waits until you press a key and press enter

i tried a few things calling the kernel routines directly using nasm, but didn't get that working yet

there are ways to do this properly ...
Back to top
View user's profile Send private message 
Jesse

Joined: 08 May 2005
Posts: 465
Location: Auckland, NZ

PostPosted: Sat 28 May 2005, 02:09    Post subject: fgetc  

Yeah, I did wonder about how compatible a program would be with different keyboard interfaces,
though I did have a thought, instead of reading from hardware, would it be possible to just do a fgetc(stdin) ?
I don't know if this would work at boot time, but I think that the kernel has to detect and configure at least one keyboard plugged into system at some point., run your program after that point and use fgetc. Maybe this would work, maybe it wont, gotta try to see Smile I'm upto my eyeballs in cdrom ioctrls at the moment.

Jesse
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0494s ][ Queries: 12 (0.0045s) ][ GZIP on ]