I want to use a second pointing device (the trackball) as a control for a specific function on a program. This means I would NOT want any mouse functionality from the trackball, I just want to get the movement data and somehow use the NPAPI to get that into our web app. Is there a way to bind a mouse/trackball to a specific program that it doesn't act as a mouse/trackball for the computer?
Thanks in advance!
UPDATED: actually ask a question
To the best of my knowledge and my understanding of how HID devices work, there is no way to do what you want to do. If you could do it at all, you could probably do it from an NPAPI plugin, but there is no way to tell the operating system not to take control of one specific pointing device as opposed to any others.
Now, if you had a special HID trackball that didn't show up as being a regular pointing device then you could possibly do it with that, but I have never heard of any way to take control of just one of potentially many HID pointing devices on windows, linux, or mac.
There may be a way to hack something together in Linux by changing the way the drivers work, etc, but I don't know of any.
Related
Since I find the default gamepad handling of Windows to be lacking, I'd like to write a custom interface for that purpose. Basically, I want to add a layer between the plugged in gamepads and the Windows gamecontroller management. While I'm not sure how to tackle this problem, these are the steps I was thinking off so far:
Disconnect any plugged in gamepads from Windows' gamecontroller management
Create virtual gamecontroller (perhaps with vJoy/pyvjoy)
Read inputs from the plugged in gamepads and apply them to the virtual gamecontrollers
However, apart from the second bullet point I don't know whether (and how) these are doable. Are there any APIs that can interact with devices the way that I need to? Do I need to get into driver programming and rewrite gamepad drivers?
I know this is a broad question to a very narrow topic, but I'm kind of at a loss where to get started. Any help would be much appreciated.
HIDGuardian covers your first bullet point:
https://github.com/nefarius/ViGEm/tree/master/Sys/HidGuardian
HIDGuardian is used by InputMapper to hide the physical gamepad when a virtual gamepad has been created for the device. This prevents applications from seeing input from the same gamepad twice.
Does anybody know the answer to the question above?
I do not think you can get this value. You have no idea what monitor is connected and while there might be drivers that actually know this type it might be a default driver. Either way, this information is not accessible to you.
Also, there might be duplicated displays, TV-output, an overhead projector and whatnot. So, the situation is more complex than the normal situation of a known monitor connected to your rendering window or fullscreen window
I bough a cheap RFID reader from eBay, just to play about with. There is no API, it just writes to stdin - that it to say, if you have Notepad open and tap an RFID tag to the reader its Id number appears in the Notepad window.
I am looking around for a reasonably priced reader/writer with an actual API (any recommendations?).
Until then I need to knock together a quick demo using what I have, just to prove the concept.
How can I best intercept the input from the USB connection? (and is there a free VCL control to do this?)
I guess if I just have a modal form with a control which is active then I can hook its on change event. But modal forms seem a bit rude. Maybe I can hook keyboard input, as it seems to be injecting like types chars?
Any idea? Please tell me if I cam not explaining this clearly enough.
Thanks in advance for your help.
In the end, I just hooked the keyboard, rather than trying to intercept the USB. It works if I check that my application is active and pass on the keystrokes otherwise. My app doesn't have any keyboard input, just mouse clicks (and what I read from RFID is digits only, so I can still handle things like Alt+F4. Maybe not the perfect solution for everyone, but all that I could get to work)
Based on your description, it sounds like the RFID reader is providing a USB HID keyboard interface.
I don't know if there is anything similar in delphi, but in libusb there is a libusb_claim_interface, which requests that the OS hand control over to your program.
A Delphi library for doing HID devices:
http://www.soft-gems.net/index.php?option=com_content&task=view&id=14&Itemid=33
Is it possible to get location data out of Google Gears, Google Gelocation API or any other web location API (such as Fire Eagle) in such a format that it appears to other software as a GPS device?
It occured to me reading these answers to my question regarding WiFi location finding, on Super User, that if I could emulate a GPS unit, many of these web services could act as a 'poor-mans' GPS to otherwise less useful software that requires it.
Is GPSD an option?
Preferably OSX & Python, but I would be interested in any implementation.
There is a very similar thread on a Python mailinglist that mentions Windows virtual COM ports and discusses Unix's pseudo-tty capabilities. If the app(s) you want to use let you type in a specific tty device file, this may be the easiest route. (Short of asking the authors to provide a plugin API for what you're trying to do, or buying yourself a $20 bluetooth GPS mouse.)
Are you using OS X?
There is a project macosxvirtualserialport on Google code that provides a graphical wrapper around some of the features of a utility called socat. I'd recommend taking a look at socat if you see potential in the pseudo-tty route. I believe you could use socat to link a pipe from a Python program to a pseudo-tty.
Most native Mac apps will be querying IOServiceMatching for a device with kIOSerialBSDRS232Type, and I doubt that a pseudo-tty will show up as an IOKit service.
In this case, unless you can find a project that has already implemented such a thing, you will need to implement a driver as described in this How to create virtual COM port thread. If you're going to the trouble of create a device driver, you would want to base it on IOKit because of that likely IOServiceMatching query. You can find the Apple16X50Serial project mentioned in that post at the top of Apple's open source code list (go to the main page and pick an older OS release if you want to target something pre-10.6).
If your app is most useful with realtime data (e.g. the RouteBuddy app mentioned in the Python mailinglist thread can log current positions) then you will want to fetch updates from your web sources (hopefully they support long-polling) and convert them to basic NMEA RMC sentences. You do not want to do this from inside your driver code. Instead, divide your work up into kernel-land and user-land pieces that can communicate, and put as little of the code as possible into the kernel part.
If you want to let apps both read and write to these web services, your best bet would probably be to simulate a Garmin device. Garmin has more-or-less documented their protocol in the IntfSpec.pdf file included with their Device Interface SDK. Again, you'd want to split as much as you could into user-space code.
I was unable to find a project or utility that implements the kernel side of an IOKit-based virtual serial interface, but I'd be surprised if there wasn't one hiding somewhere out there. Unfortunately, most of the answers I found to that question were like this, with the developer being told to get busy writing a kext.
I'm not exactly sure how to accomplish what you're asking, but I may be able to lend some insight as to how you might begin to get it done. So here goes:
A GPS device shows up to most systems as nothing more than a serial device -- a.k.a. a COM port if you're dealing with Windows, /dev/ttySx if you're in *nix. By definition, a serial port's specific duty is to stream data across a bus, one block at a time. So, it would then follow logically that if you want to emulate the presence of a GPS device, you should gather the data you're consuming and put it into a stream that somehow acts like an active serial port.
There are, however, some complications you might want to consider:
Most GPS devices don't just send out location data; there's also information on satellite locations, fix quality, bearing, and so on. Then again, nobody's made any rules saying you have to make all that data available. There's probably more to this, but I'll admit that I need to do more research in this area myself.
I'm not sure how fast you can receive data when dealing with Google Latitude, etc., but any delays in receiving would definitely result in visible pauses in your "serial port"'s data stream. Again, this may not be as big a complication as it seems, because GPS devices are known to "burst" data across the bus anyway, but I'd definitely keep an eye on that. You want to make sure there's always a surplus of data coming across, not a shortage.
Along the way you'll also have to transform the coordinates you receive into valid GPS sentences, as well. You can find specifications for those, but I would definitely make friends with the NMEA standard -- even though it is a flawed standard, it's the one everyone seems to agree on anyway.
Hope this helped you, at least a little bit. Are there anymore details specific to your problem that you think could be useful in answering this question?
Take a look to Franson GPS Gate which allows you to connect to Google Earth among other things (like simulating GPS and so on). Is windows only though but I think you could get some useful ideas from it.
I haven't looked into it very much, but have you considered using Skyhook's SDK? It might provide you with some of what you are looking for. It's available for every major desktop and mobile OS.
OK, so I know I can remap the Caps Lock key in Windows registry, but is there something useful I can map it to in the Delphi 2009 IDE? I was hoping for Code Completion (Ctrl-Space), is there a way to map the single Caps Lock key to a Ctrl-key combination?
Do yourself a favour and just download Autohotkey. This will allow you to remap the CapsLock key to absolutely any other key combination or action.
It can also do this on an application context sensitive basis (ie CapsLock automatically does different things based on the active window).
There is a useful section in the GNU Emacs FAQ For MS Windows. Emacs users like to map Caps Lock to the Ctrl key, and it should prove useful as a starting point to assigning other key combinations.
Edit: Following the trail led me to this (official) documentation page: Scan Code Mapper for Windows. Hopefully the information it contains is still relevant.
Can't you first map it some obscure non-modifier-key in the registry, then map that to the desired function in Delphi using the keyboard preferences thingy?
I personally tried the emacs-style: binding Caps Lock to the Ctrl key.
The upside is that a lot of very common actions (not just in emacs, but everywhere) can be performed with less hand moving. As just on example, deleting words backwards (which is done by Ctrl+backspace) got a whole lot easier, and it is a shortcut that works just about everywhere. For this alone, I'd map Caps Lock to the Ctrl key.
The downside here is the same as for any other non-standard modification (like Dvorak): it makes it much harder to user other people's computers. When you sit down there, you're going to definitely have a problem changing your typing instincts.
I ended up returning the Caps Lock to it usual job because I couldn't cope with not being able to type at other people's computers.