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
test if ctrl or alt or shift is pressed
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
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
Press Ctrl for extended boot options in small letters bottom right of the splash screen - see splash screens are useful.
Good job G2
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
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
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 ...
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 ...
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 I'm upto my eyeballs in cdrom ioctrls at the moment.
Jesse
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 I'm upto my eyeballs in cdrom ioctrls at the moment.
Jesse