Thanks, Tilghman - I'm going to try it. On Mon, Aug 31, 2015 at 1:59 PM, Tilghman Lesher <[email protected]> wrote:
> No, essentially your program is REPLACING the login prompt. Instead > of the login program running on tty1, your Perl program will start; > the keyboard (wedge) will go to the Perl program's stdin, and stdout > will go to that virtual screen. If you did ever connect a screen to > that Pi, the output of your program is what would be displayed there. > > On Mon, Aug 31, 2015 at 1:55 PM, Curt Lundgren <[email protected]> wrote: > > My specific worry is will the program (Perl) be hit with a login > prompt? I > > was thinking if that's the case I could use a couple of reject cards, > > misprints, etc. as user name and password. Tap one, then the other to > get > > logged in. Am I overthinking this? > > > > On Mon, Aug 31, 2015 at 1:53 PM, Tilghman Lesher <[email protected]> > > wrote: > >> > >> What language is your current program written in? > >> > >> It should work being invoked from init, although how init invokes it > >> is different based upon which init program is running on the system. > >> On Ubuntu 12.04, the file to edit is /etc/init/tty1.conf. Once it's > >> running, just read from STDIN. > >> > >> On Mon, Aug 31, 2015 at 1:47 PM, Curt Lundgren <[email protected]> > wrote: > >> > It's a generic USB reader for Mifare 1K Classic cards. The reader > puts > >> > out > >> > a 13.5 MHz field which is picked up by a few turns of wire embedded in > >> > the > >> > card. The field provides power to the chip, which can then do > >> > bidirectional > >> > communication with the reader. This is a simple reader that only > grabs > >> > the > >> > CSN, card serial number. It's a 32-bit code which this reader gives > me > >> > as 8 > >> > hexadecimal digits. The range of the card/reader is about 1-1/2" so a > >> > 'tap' > >> > of the card on the reader yields a solid read every time. > >> > > >> > It's HID, so it outputs 'scan codes' as detailed above. Tilghman > offers > >> > an > >> > interesting approach, still not quite sure how I'd go about that. > >> > > >> > If these were Hollerith cards, you'd have to call me Hangin' Chad… > >> > > >> > On Mon, Aug 31, 2015 at 1:24 PM, Jack Coats <[email protected]> wrote: > >> >> > >> >> I am to old... I thought you were talking 80 or (the smaller) 96 > column > >> >> cards! ... Many of those readers put out EBCDIC instead of ASCII. > >> >> But as always, I digress into ancient history when mainframes roamed > >> >> the > >> >> earth. > >> >> > >> >> Now that I am past the 20th century in my thinking, what flavor of > card > >> >> reader are you using? How is it connected? > >> >> > >> >> On Sun, Aug 30, 2015 at 8:19 PM, Tilghman Lesher < > [email protected]> > >> >> wrote: > >> >>> > >> >>> Sounds like what you're talking about is that the device is acting > as > >> >>> a keyboard wedge -- that is, it's inserting a stream of characters > >> >>> into the keyboard buffer, probably through its device driver. I > have > >> >>> a magnetic card reader here that works in precisely the same way. > >> >>> > >> >>> The long and short of it is that your program would need to be > running > >> >>> in the foreground; that is, having its stdin being supplied by the > >> >>> console. Probably the best way to do this in Linux on boot would be > >> >>> to have your program run directly from init, associated with tty1, > NOT > >> >>> background itself, and as long as the machine stays on that terminal > >> >>> device (and it should), your program should get all keyboard input > >> >>> directly from stdin (fd 0). > >> >>> > >> >>> > >> >>> On Sun, Aug 30, 2015 at 8:01 PM, Curt Lundgren <[email protected]> > >> >>> wrote: > >> >>> > I'm working on a program for a Raspberry Pi (one of the cool new > >> >>> > ones > >> >>> > with > >> >>> > the quad-core CPU and a gigabyte of RAM). The program will run > as a > >> >>> > daemon > >> >>> > and this unit is headless - there's no keyboard plugged in. Just > a > >> >>> > USB > >> >>> > Mifare HID card reader that outputs 8 hex characters when a card > is > >> >>> > in > >> >>> > proximity, then an 'Enter.' > >> >>> > > >> >>> > It's actually outputting scan codes, but I figure I can convert > them > >> >>> > to > >> >>> > the > >> >>> > appropriate hex codes. > >> >>> > > >> >>> > I understand if I was running on the console, tapping a card on > the > >> >>> > reader > >> >>> > would cause the hex string to be input wherever my cursor is. I'd > >> >>> > love > >> >>> > to > >> >>> > be able to redirect that input to my program, but I'm clueless on > >> >>> > how > >> >>> > that's > >> >>> > done. My google-fu isn't working for me here either. > >> >>> > > >> >>> > The card reader does show up as /dev/input/event0 and if I cat > that, > >> >>> > it > >> >>> > outputs a bunch of binary stuff. I can send it to a file and a > hex > >> >>> > dump of > >> >>> > part of that file looks like this: > >> >>> > > >> >>> > 00000000: eba1 e355 6032 0600 0400 0400 2700 0700 > ...U`2......'... > >> >>> > 00000010: eba1 e355 6032 0600 0100 0b00 0100 0000 > ...U`2.......... > >> >>> > 00000020: eba1 e355 6032 0600 0000 0000 0000 0000 > ...U`2.......... > >> >>> > 00000030: eba1 e355 7251 0600 0400 0400 2700 0700 > ...UrQ......'... > >> >>> > 00000040: eba1 e355 7251 0600 0100 0b00 0000 0000 > ...UrQ.......... > >> >>> > 00000050: eba1 e355 7251 0600 0000 0000 0000 0000 > ...UrQ.......... > >> >>> > 00000060: eba1 e355 ad70 0600 0400 0400 1f00 0700 > ...U.p.......... > >> >>> > 00000070: eba1 e355 ad70 0600 0100 0300 0100 0000 > ...U.p.......... > >> >>> > 00000080: eba1 e355 ad70 0600 0000 0000 0000 0000 > ...U.p.......... > >> >>> > 00000090: eba1 e355 e48f 0600 0400 0400 1f00 0700 > ...U............ > >> >>> > 000000a0: eba1 e355 e48f 0600 0100 0300 0000 0000 > ...U............ > >> >>> > 000000b0: eba1 e355 e48f 0600 0000 0000 0000 0000 > ...U............ > >> >>> > 000000c0: eba1 e355 26af 0600 0400 0400 2400 0700 > ...U&.......$... > >> >>> > 000000d0: eba1 e355 26af 0600 0100 0800 0100 0000 > ...U&........... > >> >>> > 000000e0: eba1 e355 26af 0600 0000 0000 0000 0000 > ...U&........... > >> >>> > 000000f0: eba1 e355 64ce 0600 0400 0400 2400 0700 > ...Ud.......$... > >> >>> > 00000100: eba1 e355 64ce 0600 0100 0800 0000 0000 > ...Ud........... > >> >>> > 00000110: eba1 e355 64ce 0600 0000 0000 0000 0000 > ...Ud........... > >> >>> > > >> >>> > Don't know if the formatting will display properly, but I've > bolded > >> >>> > a > >> >>> > few > >> >>> > bytes. The 0x27 is '0' and we see keypress and key release. This > >> >>> > is > >> >>> > followed by 0x1F (2) and 0x24 (7) - we march through the rest of > the > >> >>> > string > >> >>> > and finally arrive at the 0x28 Enter key: > >> >>> > > >> >>> > 00000300: eba1 e355 3626 0800 0400 0400 2800 0700 > ...U6&......(... > >> >>> > 00000310: eba1 e355 3626 0800 0100 1c00 0100 0000 > ...U6&.......... > >> >>> > 00000320: eba1 e355 3626 0800 0000 0000 0000 0000 > ...U6&.......... > >> >>> > 00000330: eba1 e355 9145 0800 0400 0400 2800 0700 > ...U.E......(... > >> >>> > 00000340: eba1 e355 9145 0800 0100 1c00 0000 0000 > ...U.E.......... > >> >>> > 00000350: eba1 e355 9145 0800 0000 0000 0000 0000 > ...U.E.......... > >> >>> > > >> >>> > I don't pretend to understand scan codes, but 48 bytes for > keypress > >> >>> > and > >> >>> > another 48 for key release? Seems excessive, but it can be > handled. > >> >>> > The > >> >>> > hex 0x01 below the scan code is keypress, the 0x00 below the other > >> >>> > scan > >> >>> > codes is key release. > >> >>> > > >> >>> > Questions: Can this data be grabbed from some convenient place in > >> >>> > the > >> >>> > OS, > >> >>> > preferably as a nice 8-character string? What does the OS do with > >> >>> > HID > >> >>> > input > >> >>> > when the Pi is running headless? The current plan says there will > >> >>> > never be > >> >>> > a real keyboard plugged in, just the card reader. > >> >>> > > >> >>> > Does anyone know what Linux does with input from an HID device > when > >> >>> > there's > >> >>> > no session running from the console? Does it get intercepted by a > >> >>> > login > >> >>> > screen? > >> >>> > > >> >>> > OS is Raspbian Wheezy, apparently version 7 on a 3.18.11 kernel. > >> >>> > > >> >>> > TIA > >> >>> > > >> >>> > Curt > >> >>> > > >> >>> > -- > >> >>> > -- > >> >>> > You received this message because you are subscribed to the Google > >> >>> > Groups > >> >>> > "NLUG" group. > >> >>> > To post to this group, send email to [email protected] > >> >>> > To unsubscribe from this group, send email to > >> >>> > [email protected] > >> >>> > For more options, visit this group at > >> >>> > http://groups.google.com/group/nlug-talk?hl=en > >> >>> > > >> >>> > --- > >> >>> > You received this message because you are subscribed to the Google > >> >>> > Groups > >> >>> > "NLUG" group. > >> >>> > To unsubscribe from this group and stop receiving emails from it, > >> >>> > send > >> >>> > an > >> >>> > email to [email protected]. > >> >>> > For more options, visit https://groups.google.com/d/optout. > >> >>> > >> >>> > >> >>> > >> >>> -- > >> >>> Tilghman > >> >>> > >> >>> -- > >> >>> -- > >> >>> You received this message because you are subscribed to the Google > >> >>> Groups > >> >>> "NLUG" group. > >> >>> To post to this group, send email to [email protected] > >> >>> To unsubscribe from this group, send email to > >> >>> [email protected] > >> >>> For more options, visit this group at > >> >>> http://groups.google.com/group/nlug-talk?hl=en > >> >>> > >> >>> --- > >> >>> You received this message because you are subscribed to the Google > >> >>> Groups > >> >>> "NLUG" group. > >> >>> To unsubscribe from this group and stop receiving emails from it, > send > >> >>> an > >> >>> email to [email protected]. > >> >>> For more options, visit https://groups.google.com/d/optout. > >> >> > >> >> > >> >> > >> >> > >> >> -- > >> >> ><> ... Jack > >> >> > >> >> The Four Boxes of Liberty - "There are four boxes to be used in the > >> >> defense of liberty: soap, ballot, jury and ammo. Please use in that > >> >> order." > >> >> "Whatever you do, work at it with all your heart"... Colossians 3:23 > >> >> "Anyone who has never made a mistake, has never tried anything new." > - > >> >> Albert Einstein > >> >> "You don't manage people; you manage things. You lead people." - > >> >> Admiral > >> >> Grace Hopper, USN > >> >> "Tell me and I forget. Teach me and I remember. Involve me and I > >> >> learn." - > >> >> Ben Franklin > >> >> > >> >> -- > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "NLUG" group. > >> >> To post to this group, send email to [email protected] > >> >> To unsubscribe from this group, send email to > >> >> [email protected] > >> >> For more options, visit this group at > >> >> http://groups.google.com/group/nlug-talk?hl=en > >> >> > >> >> --- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "NLUG" group. > >> >> To unsubscribe from this group and stop receiving emails from it, > send > >> >> an > >> >> email to [email protected]. > >> >> For more options, visit https://groups.google.com/d/optout. > >> > > >> > > >> > -- > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "NLUG" group. > >> > To post to this group, send email to [email protected] > >> > To unsubscribe from this group, send email to > >> > [email protected] > >> > For more options, visit this group at > >> > http://groups.google.com/group/nlug-talk?hl=en > >> > > >> > --- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "NLUG" group. > >> > To unsubscribe from this group and stop receiving emails from it, send > >> > an > >> > email to [email protected]. > >> > For more options, visit https://groups.google.com/d/optout. > >> > >> > >> > >> -- > >> Tilghman > >> > >> -- > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "NLUG" group. > >> To post to this group, send email to [email protected] > >> To unsubscribe from this group, send email to > >> [email protected] > >> For more options, visit this group at > >> http://groups.google.com/group/nlug-talk?hl=en > >> > >> --- > >> You received this message because you are subscribed to the Google > Groups > >> "NLUG" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to [email protected]. > >> For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > -- > > You received this message because you are subscribed to the Google Groups > > "NLUG" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > > http://groups.google.com/group/nlug-talk?hl=en > > > > --- > > You received this message because you are subscribed to the Google Groups > > "NLUG" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Tilghman > > -- > -- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nlug-talk?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
