I have used libusb to find a usb mouse in my system, detach the associated kernel driver associated with it and read the data from its endpoint which gives me an array of information that is sent from the device to the host.
Since I detached the kernel driver, the mouse pointer does not move when moving the mouse physically (which is alright). However I now want to use the obtained data (as above) to move the mouse pointer without actually moving the mouse. So I need to know where and how to write this data to achieve this objective.
Please guide me on how I can do this.
Related
I've been looking around for a way to detect if I have a physical keyboard attached to my computer from vb.net but can't find anything. The problem is all googled results returned think what I mean is detecting a keyboard input (AKA: keystrokes). But I want to know if there is a physical keyboard attached. I have also looked into listing USB devices but realize that not all computers (take notebooks for instance) use USB keyboards.
How can I check if a keyboard is attached/operational from VB.net?
I've been playing with a generic usb camera to take snapshots every few seconds. With the help of this SO question, I was able to get the camera working; however, when you click the button to connect to the camera, a dialog box appears.
The difference between the other question and my question is that I have two video sources: a built in webcam and a usb camera. I also intend to have multiple cameras connected, all taking pictures. It appears that when you have multiple devices, you always get the dialog box where you have to choose the device. I'm trying to automatically choose the camera (and eventually cameras, plural) without this dialog box.
There are other pieces of sample code that I have played with - samples that have a device listbox that is populated; I thought this was what I needed (and I'd just remove the listbox control and process the list and what to connect to in code), but every one of these samples populates the listbox with "Microsoft WDM Image Capture (Win32)" instead of the devices listed in the dialog after attempting to connect to this "device."
Surely there's a way to automate the webcam(s) I'm connecting to instead of having to choose it from a dropdown in a Windows dialog, right? How would I go about doing this?
The solution ultimately was to use EMGU to access the camera; this also allows for connecting to multiple cameras at the same time.
I have an arduino uno kit. I 'll be giving it signals .These signals should be able to navigate the slides of powerpoint. Also these signals will be coming thru the serial port .
hence is there any software which allows me directly to do the required slide change ?Or should i be writing a code for the same ? If so in which language as iam quite new to this type of stuffs!
This is basically the same question as this one: What is the best way to access a serial port from VBA?
The answer refers to here: http://www.thescarms.com/vbasic/commio.aspx
One possibility would be to have the arduino emulate the serial mouse protocol and send mouse clicks for the Powerpoint navigation (just like pressing the mouse button to go to the next or previous slide). The problem is that as far as I know there are no serial mouse emulation libraries for Arduino, but I could be wrong.
Another option would be use use the LUFA USB library to have your UNO emulate a USB mouse. The problem with this option is that while LUFA is compatible with the UNO hardware, you need to reflash the firmware. And I believe you can't program it with the arduino IDE.
The easiest option would be to not use the UNO but get a Leonardo or a Teensy both can act as a USB Mouse device and can be programmed with the Arduino IDE.
The hardest part would be reading the serial data coming in and ensuring that it's valid. Then, depending on what command you receive (next slide, previous slide, etc.), send simulated mouse clicks or keyboard presses to PowerPoint. Better yet, you could just use the PowerPoint COM interface.
We have a hardware device, with an LCD display. It supports an USB interface to connect keyboard and mose. Using these keyboard and mouse, we can navigate to varios menu items and edit entries.
We have couple of test cases written to verify that mouse click and keyboard input events are working when pressed respective key.
My task is to automate these test cases.
I donot have any control to the hardware device, as I can not access the o/s kernel or any application running there. There is one way to verify what is currently displayed on the UI. So I have to use that and verify whether the mouse/keyboard has performed the appropriate events.
As I have gone through couple of previous posts, it seems like that one of the way to achieve this is through virual HID device driver rather than actual keyboard and mosue. But I am not sure how to achieve it.
Please do help me for it. I am fine with any programming language.
I am more interested to simulate the mouse and keyboard events.
You probably don't need to write your own driver. AutoHotKey does pretty much anything you can think of, and the scripting language is quite easy to learn.
You can get it here:
http://www.autohotkey.com/
Since you're using linux, here's a similar project that will run on linux:
http://sikuli.org/
When I connect my digital camera with my computer, a dialog box containing all the registered programs can be used to get images from the camera will appear. Now I want to add my own program in the list, so that when I click the item of my program, I can use my own program to get images from the digital camera.
Thank you very much.
WIA has a Device Manager object that provides an interface that allows for programs to register for event notifications.
Contacting the Device Manager
You use the IWiaDevMgr interface to interact with the device manager. You get a pointer to that interface with a call to CoCreateInstance():
IWiaDevMgr *pWiaDevMgr;
HRESULT hr;
hr = CoCreateInstance(CLSID_WiaDevMgr,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IWiaDevMgr,
(void*)&pWiaDevMgr);
Registering a program for an event
Then, registering a program to be run when the event fires is as simple as:
pWiaDevMgr->RegisterEventCallbackProgram(
WIA_REGISTER_EVENT_CALLBACK,
NULL,
&WIA_EVENT_DEVICE_CONNECTED,
bstrCommandline,
bstrName,
bstrDescription,
bstrIcon);
The command line, name, description, and icon are all BSTRs because they are passing through a COM interface. You can either use SysAllocString() and its friends to create them, or use the classes supplied by Visual C extensions or ATL to create and manage them.
Releasing the Device Manager
If you aren't using a COM-aware smart pointer for the interface, then don't forget to release the reference taken by CoCreateInstance():
pWiaDevMgr->Release();
If you don't release it, the COM system will find a way to punish you, but it might not be immediately obvious...
Unregistration
Casual testing shows that deleting a registered event works when all four parameters used to register the event are passed exactly. The call is:
pWiaDevMgr->RegisterEventCallbackProgram(
WIA_UNREGISTER_EVENT_CALLBACK,
NULL,
&WIA_EVENT_DEVICE_CONNECTED,
bstrCommandline,
bstrName,
bstrDescription,
bstrIcon);
This is a potential annoyance because there seems to be no documented API to list the registered events. This implies that if your installer registers a program, then it should also keep a record of the arguments used so that your uninstaller can unregister the event.
The event parameters
The command line can contain the strings %1 and %2 which will be replaced by the port name and the GUID of the event that fired, respectively, before the command line is parsed.
The icon , name and description are displayed in the list presented to the user when the camera is plugged in. The name should be shorter than the description.
The icon is a combination of a file name and a resource identifier. A good default value is "sti.dll,0" which will be a generic image of a camera and scanner. If you supply your own icon, the string almost certainly must include a fully-qualified path to the DLL. Going out on a limb, I'd imagine that deliberately including a comma anywhere in the path other than as the separator before the resource id will cause trouble.
Behind the scenes
The actual location where WIA/STI stores the list of events is not documented. However, with a little searching in regedit, I located the event catalog on my XP SP3 system. One might imagine that it would be found in a similar location in other systems...
The registry key HKLM\SYSTEM\CurrrentControlSet\Control\StillImage\Events contains a subkey for each event known to the system. Each key has a value named GUID containing the GUID that identifies that event.
Device Connected event handlers are listed in the Connect subkey, for example.
Keys for individual WIA/STI devices can be found in the HKLM\SYSTEM\CurrentControlSet\Control\Class\{6BDD1FC6-810F-11D0-BEC7-08002BE2092F} key among other places.
Remember that these locations are not documented. Touch them at your own risk, your mileage will vary, ...
You need to use the WIA (Windows Image Acquisition) interface. IWiaDevMgr provides three methods to do this: RegisterEventCallbackProgram, RegisterEventCallbackCLSID, and RegisterEventCallbackInterface. If you want Windows to start your program when the user clicks you in the Autoplay dialog, you can use either RegisterEventCallbackProgram or RegisterEventCallbackCLSID.