C++ detect Apple headphone buttons on Windows - windows

BACKGROUND INFORMATION:
I've been trying to detect a button click from Apple headphone. The headphone is connected to MacBook Pro that is running Windows. Its not virtual machine. It is running windows normally with a complete windows driver from Apple through Boot Camp.
The headphone is a standard Apple headphone consisted of three buttons: a volume up, volume down, middle buttons and a Mic.
When I am using Mac Os, If the volume up button is presses on the ear phone, Mac Os would increase its volume by one. It also decreases its volume when the voulume down button is pressed on the ear phone.
Standard ear/headphone uses three conductive pins to receive(L/R speakers only) signals while the apple version is using four conductive pins to receive(L/R speakers) and send(buttons) signals. This headphone was made for iPhone but I was surprised when it worked on Mac Os.
This made me believe that the MacBook Pro hardware is built to support this four conductive pins earphone. It works on Mac Os but NOT on Windows. My goal is to develop a tiny software that will allow the apple headphone to function on Windows running on Apple hardware.
I know how to increase Windows volume using C++ and Win32 API but I am stuck on the part where I actually have to detect the button click from the headphone.
QUESTION:
1) what ways can I detect the Input(button clicks) from the headphone?
It looks like this person here was able to read it. He only did it while running on Mac Os
Detect hardware headphone presses in mac
2) If I compile the code this person got working on Mac OS as a DLL file and then call the function while running Windows, will it work?
3) Do I need to make my own driver to get this to work?
4) The code below is from the link I posted above. What windows API function, class is equivelent to the follwoing Mac Os code below?
id array = [[DDHidDevice allDevices] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:#"productName == \"Apple Mikey HID Driver\""]];
DDHidDevice *mic = [array count] ? [array objectAtIndex:0] : nil;
// it isn't a keyboard
NSLog(#"%#", mic.primaryUsage);
assert(mic.usage==1 && mic.usagePage==12);
THINGS I'VE TRIED:
1) I tried using GetLastInputInfo() with LASTINPUTINFO from Windows API to sniff any hardware input but failed miserably. It worked on keyboard and mouse but nothing else.
2) I also tried to use RAWINPUTDEVICE to read a low level input from hardware but it only worked on keyboards, mouse and joystick input. It didn't detect the headphone button press.
I am running out of ideas. Anyone got any solution?
NOTE: This is not a duplicate question as I am asking how to do this on Windows not Mac.

Related

Windows iot LCD screen for raspberry pi

Please apart from the 7" LCD touch screen, which other lcd screen can work with raspberry pi using windows iot core operating system
It is recommended to use the screen device which is listed in the Hardware compatibility list. As mentioned in the document, this list is not exhaustive. There are many other peripherals not listed on this page that are compatible with Windows 10 IoT Core. You may try with other screen, maybe it is also compatible. If you just want to use a display screen without touch input, in general the screen with HDMI interface is usable.

Mac OS sees usb dongle as keyboard

I am trying to connect controller from xkeys.com to my mbp (10.11.5) the manual suggests me using controllermate.app and I have installed. When I plugin the interface, mac always sees the interface as a keyboard.
From controllermate it says. Controllermate driver is not being used, The driver at /System/Library/Extensions/IOHIDFamily.kext is likely being used.
So is that possible reset this usb settings on macos and use controllermate's driver instead of IOHIDFamily.kext
Finally got problem solved! Here is the answer: I used to use my xkey dongle on an Android table and the dongle has been assigned "Support text, mouse, multimedia macros". So I resetted the dongle and assigned "Supports game controller, mouse, multimedia macros". Now when plugin to mac, controllermate's driver still cannot be used but mac os sees xkey dongle as a game controller. Then all the buttons connected to the dongle are working.

iMac developing Bluetooth 4.0 application with external dongle

I have a Late 2009 iMac which doesn't support Bluetooth 4.0 and an USB Bluetooth 4.0 dongle (CSR).
I need to write an OSX application which transfers data with a Bluetooth 4.0 device.
If I plug the dongle, the CBCentralManager returns the state CBCentralManagerStateUnsupported since OSX has loaded the driver for the internal Bluetooth device.
If I issue the following command:
sudo nvram bluetoothHostControllerSwitchBehavior="always"
the OSX loads the driver for the dongle, the CBCentralManager recognize the device but unfortunately both wireless keyboard and magic mouse stop working. Presumably because they use a previous version of Bluetooth.
Is there any way to have both internal Bluetooth and external dongle working together ?
Aside from the development, which I can manage with USB keyboard and mouse, this issue prevents older iMacs to use my app.
Thank you in advance.
...unfortunately both wireless keyboard and magic mouse stop working. Presumably because they use a previous version of Bluetooth.
This is not true. The iMac takes some time to recognize that it has not keyboard and mouse configured. After waiting some time, the iMac asks for pairing keyboard and everything work correctly with the external dongle.

How do I go about writing a windows driver for a bluetooth device?

I am looking for some advice/input on writing a device driver. I have never written one for windows before, let alone for bluetooth.
Can you recommend a book or website or something to get me started? I have the windows driver kit, and the examples therein but with out some place to start I am dead in the water.
The specifics: My friend gave me his mac Magic Mouse. I have a windows 7 machine. With the mouse set up as just a generic HID device it works ok as a two button mouse with no scroll, the motion is smooth and the acceleration what you expect in a windows mouse.
The mouse actually has a fairly good lpi resolution, making it pretty sensitive. There are mac drivers available, extracted from bootcamp. They kind of work. The cursor will randomly freeze or stop responding to the mouse's movement, which is buffered, and then leap once whatever has caused the stall stops. As an added touch the mac drivers make the cursor move like it would on a mac, with that logarithmic acceleration, that will completely throw off any windows user. With the driers you get vertical and horizontal scroll, but that's it. There is no multi touch functionality, and you can't change any of the behaviors, like acceleration. There isn't multiclutch for windows, or other 3rd party software for a multi touch mouse.
So I figured I would endeavor to make my own drivers and multi touch functionality in windows for this thing. I know mac will never support it properly under windows and windows won't write there own drivers until there is a reason.
Also if any one knows of any one else trying to do the same or similar things, point me to them.

What devices are available to test WM_GESTURE and WM_TOUCH code on a desktop machine?

I'm writing some code to handle WM_GESTURE and WM_TOUCH events in Windows 7, but I can't figure out how to test it. I do my development in Boot Camp on a 17" Mac Book Pro.
So far, I have determined that the Boot Camp trackpad driver in Windows 7 does not generate those events, and this generic trackpad I found on Amazon.com that claims to be 'multi-touch' works as advertised, but not by creating WM_GESTURE or WM_TOUCH events. I verified this by using Spy++ to report the events; nothing with the WM_GESTURE or WM_TOUCH value was reported.
What kind of hardware is supposed to generate these kinds of events? At this point, I'm assuming it's only for tablet or mobile (Windows CE) hardware, but I'd appreciate any other suggestions.
I suppose there's another way to approach this -- I want to get functionality similar to Cocoa's [NSResponder swipeWithGesture:] and related methods, which report back swipes, rotation, and other gestures on the trackpad. WM_GESTURE appears to be the equivalent on Windows 7.
An other option, which would require only another physical mouse device to work with, and should get you at least 95% of the way there is the Multi-Touch Vista project, which can emulate up to 256 touch points using physical devices - thus the need for an extra mouse, or two since it can be awkward to simultaneously work with a mouse in one hand and trackpad with another.
There are several monitors out there supporting touch with Windows 7. For example: Acer T230H.
HTH
Wacom makes several touchpads that support multitouch; a particularly inexpensive version is the Bamboo Touch. This gives you touch without having to buy another monitor - although it doesn't give that direct interaction feeling.

Resources