Windows HID device driver for USB Keyboard - windows

I've this problem to solve with an USB device:
connected to POS PC (Windows POSReady 2009) there is a USB Keyboard and a USB Dallas I-Button reader
USB Reader is connected to MoBo USB bus, and shows up as USB Composite device:
USB Composite Device USB\VID_134B&PID_0206&REV_0100
Compatible HID device HID\VID_134B&PID_0206&REV_0100&MI_01
USB input device (1st instance) USB\VID_134B&PID_0206&REV_0100&MI_00
USB input device (2st instance) USB\VID_134B&PID_0206&REV_0100&MI_01
HID Keyboard HID\VID_134B&PID_0206&REV_0100&MI_00
when I read I-Button with reader, the code inside the button is added to keyboard buffer (as it was typed with physical keyboard) and active application (wich has keyboard focus) receive the code
my application must interract with codes readed by the USB device, however I have to have focus costantly on a TextBox to receive the code
this not always is possible, specially with unattended MessageBoxes, wich takes focus (and keyboard input) and can create malfunctions
best of all should be having a reader on serial port, or TCP/IP, but this is the only one choice we have (we cannot change reader)
So, my idea is to trap incoming "keypress" from reader keyboard, avoid append in system keyboard buffer, and pass them to my application via WM_USER, WM_COPYDATA, Socket or other method.
So, the goal would be to write a driver, to apply ONLY to specific USB HID device (the I-Button reader, but NOT to the real PC keyboard) who block keypress and send to application in some way.
I checked for the "keyboard filter" Microsoft way, but I can block only some combinations of keys, but this is not my goal.
I think I should create a custom of personal "kbdhid.sys" and/or "kbdcalss.sys" driver and apply ONLY to my USB HID Reader.
Could someone point me out the right direction?
Thanks a lot

set your reader to send a prefix before sending the code
monitor the keyboard que for the prefix and have your application popup so it receives keyboard input.
however many readers can only be set to send a control code like STX - witch is control_B - and in use by windows.

Related

USB device opens Applications, then types in text field

I got a letter in the mail that contained a small USB device. Here is what it loks like: http://imgur.com/a/VEtNK
When I plug it into my computer it seems to hover over the programs in my Dock and then opens one. It then types a link into a text field that is available. I originally had Skype in the dock and it defaulted to that one, strange. I removed Skype from the dock and now it opens to System Preferences.
Here's a video of what happens as I plug it in: https://www.dropbox.com/s/yuw6ggvo77rkvwh/Test1MysteryDevice.mov
Also, it does not appear like a memory stick does on my computer. I can't seem to locate it when it's plugged in. It would be cool if I could find it somehow. It would be even cooler if I could program it to do something I wanted.
Thanks, and if anyone can help out that's awesome or if you could point me to a forum/anywhere that might be able to help out, that'd be great!
Probably it self-identifies as a HID (Human Interface Device), specifically a keyboard. As soon as it is accepted as a keyboard by the OS it can send any sequence of keystrokes, and the OS will assume that it is input from a human user.
Scripting such behavior is easy using Applescript.
However automatically running a program from a USB stick when it is inserted is supposed to be impossible on OS X, as auto-run is a security risk.
Of course at the very least a custom USB device could be made to act like a mouse and keyboard, so even without autorun it's a risk to plug strange devices into your computer.
To get more info on the device you can go to System Profiler and look for the device on the USB bus.
If it is a custom device pretending to be a keyboard then it's probably hardwired to do what it does, and you probably won't be able to reprogram it; you'd need to find a manufacturer that will sell you customized devices.

Hide USB Audio device on MAC OS X using custom kext

I am developing an application which does custom audio processing and sends the processed audio to the USB headset. My requirement is that the USB headset should not be visible to the user in the list of Audio output devices in System Preferences. Using "SampleUSBAudioOverrideDriver" code-less kext sample code from Apple, I'm able to change the interface name but I really need to hide it.
Is subclassing AppleUSBAudioDevice an option?
The recommended way to do pre-processing of a USB audio device's input and output streams in kernel space is to use the AppleUSBAudioPlugin API. This kext does not appear in the list of devices because it isn't an instance of IOAudioEngine, so there is no "hiding" involved.

Windows mobile 6.5 IME

Is that possible to send characters to currently open text box via IME ? What I am trying to do is that I have Bluetooth module that handles connection between Bluetooth keyboard and windows mobile device , when user press key on Bluetooth keyboard Bluetooth module receive it and send it to currently open text box via IME. You Comment will greatly help me as i am newbie in Windows Mobile development.
if the BT keyboard is using the HID protocol you do not need any additional software. All key strokes should be automatically routed as keyboard input to the right input.
If you need to write your own software, you need to open a COM port connection to the BT keyboard. Then your app can receive the BT keyboard messages and issues them as keyboard messages. See also http://www.hjgode.de/wp/2011/11/10/keywedge-updated/
But at all, your WM6.5 should have the HID drivers and so, after connection to the BT keyboard you do not have to do anything more.
Post the device model name, if you need more assistance.
regards
Josef

PS2 barcode scanner doesn't work

I have problem with Zebex Z-3000 barcode scanner. It is connected to my PC via PS2 port. Does anybody knows about PS2 scanners. I had no problem with USB scanners but I ca't get PS2 scanners work. Do I have to listen PS2 port?
No, usually PS/2 scanners will simulate keypresses as if the barcode's value had been typed on the keyboard.
Is it recognising the barcode but not sending data, or not even beeping?
Scanners generally come with (or you can obtain) a set of configuration barcodes to control the types of codes it recognises and how the values are formatted (whether it appends a carriage-return, for example). You could try contacting the manufacturer or scour their website (now that it's working again) to find these.
I also have a barcode scanner with PS/2 connector. A "keyboard wedge" y connector to be precise. When I plug only the scanner to the PC and perform scanning, I only head a beep sound without any text written in text editor, which I use to test it.
Now, when I plug a PS/2 keyboard into the Y connector, so it's keyboard+scanner connected to the PS/2 port, I could see some text written in the text editor when performing test.
So, the key point is that you need to have the keyboard attached to the Y connector.
PS/2 barcode scanners are "keyboard wedge" scanners that plug in between a PS/2 keyboard and a computer's PS/2 port. When a barcode is scanned, they send the data to the computer as if it were keyboard input.
The ZEBEX Z-3000 barcode scanner has a set of configuration barcodes. Try to use those to get the scanner working if when you try scanning into Notepad, the scanner does not send any data. The scanner might be incorrectly set to RS-232C or USB mode (instead of PC/AT mode), or the barcode symbology you are trying to scan might not be enabled.
(Users of other models of barcode scanners should consult their respective manufacturers' programming guides instead.)

How do I tell OS X to ignore the input from one of two connected USB mice?

I have two USB mice connected to my Mac, one of which I'm using as a scanner. I need access to the Generic X and Y data but I don't want that data to move the cursor. How, under either carbon or cocoa environments, do I tell the system to ignore the mouse as a pointing device?
Edit: after some digging I've found that I can turn off mouse position updating with the CGAssociateMouseAndMouseCursorPosition() function, but this does not allow me to specify a single mouse. Can anyone explain the OS X relationship between HID mouse devices and the cursor? There has to be a binding between the hardware and software on a device by device basis but I can't find it.
I would look into writing a basic user-space driver for the mouse.
This will allow you direct access to the mouse as a USB device. You can also take control of the device from the system for your exclusive use.
There is some documentation here:
Working With USB Device Interfaces
To get you started, the set up steps to connect to a USB device go like this (I think, my IOKit is rusty)
include < IOKit/IOKitLib.h > and < IOKit/usb/IOUSBLib.h >
find the device you are interested in using IOServiceMatching(). This lets you pick find the correct USB device based on its properties, including things like vendor ID, &c. (See the IORegistryExplorer tool screen shot below)
get a USB plugin instance (let's call it plugin) with IOCreatePlugInInterfaceForService()
use plugin from step 2 get a device interface (let's call it device) using (**plugin)->QueryInterface()
device represents a connection handle to your USB device--open it first using either (**device).USBDeviceOpen or (**device).USBDeviceOpenSeize(). from there you should be able to send/receive data.
Sounds like a lot I know.. and there might be an easier way, but this is what comes to my mind. There may be some benefits to having this level of control of the device, not sure. good luck.

Resources