0

I have set up a RPi with an NFC reader and everything is working fine. I'm using libnfcs nfc-eventd to read the tags.

In order to achieve my goal, I need to get the UID of the tag into an input field in the browser - this is the tricky part.

I tried playing with stdin/stdout and some other tools but I don't seem to get any results. nfc-eventd offers normal bash to start with, so I can use bash, py or whatever :)

1

Here's a few ideas that may (or may not) help:

  • Idea #1: If your browser happens to be dwb, you could have your app send an "F", which activates the "follow" function. You can then send the two character combination next to the item that you want to activate, followed by your UID. You can achieve something very similar to that using either VimiumPlus or pentadactyl depending if your browser is Chrom[e/ium] or Firefox. There's a caveat to this: The above won't work if your input box isn't actually visible when the "F" key is pressed.

  • Idea #2: Any of the aforementioned browsers also have support for userscripts using greasemonkey (or nothing extra at all in the case of dwb), which should allow you to run a simple document.querySelector() call to find your input box and add your UID to it. This should be the easiest to implement, at the expense of having to run a big bulky browser on a RPi.

  • Idea #3: You could use something like selenium's webdriver, which allows you to "drive" a headless web server where you can send keystrokes and other events very efficiently. This may be the best option for the RPi, considering that this uses very little resources (or even less than that if you run the server somewhere else).

  • Idea #4: You could build your own custom browser using something like breach, with just the parts that you need, such as receiving commands using dbus messages, which should make things faster on a RPi. This is something that's I have no experience with at all, but I hear it's pretty easy to get started.

Hope this gets you going in the right direction. Good luck! P.S. Couldn't post more links because of my noobness...

0

I don't think the above #1 idea would work. IIRC the key combo for vimium is random, even for the same links after page refreshes.

2 seems like your best shot. Depending on exactly how you're trying to get this done, may pass on grease monkey and tinker around with Node. You can get a server up and running with about 10 lines of code, and then have it watch that page and inject what you need when it's available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.