Coder Social home page Coder Social logo

bthscontrol's People

Contributors

jamesfator avatar tverlaan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bthscontrol's Issues

Can't get service to work (on El Capitan 10.11.3)

I can't compare to any previous versions of OS X, but I've tried everything I can think of and I can't seem to get BTHSControl to respond to bluetooth evens from my headphones (e.g. Play/Pause still starts iTunes). I've also tried rebooting between service installations to no avail.

Here's a sample of what my syslog output looks like:

30/01/16 19:49:56,000 kernel[0]: IOBluetoothDevice::setProperties() -- calling mHCIController->CallCreateDeviceReporter() -- this = 0x3c00 
30/01/16 19:49:56,000 kernel[0]: IOBluetoothHostController::CallCreateDeviceReporter -- calling enqueueAction() -- device = 0x3c00 
30/01/16 19:49:56,000 kernel[0]: IOBluetoothHostController::CreateDeviceReporterAction -- device = = 0x3c00 
30/01/16 19:49:56,000 kernel[0]: IOBluetoothHostController::CreateDeviceReporterAction -- calling CreateDeviceReporter() device = = 0x3c00 
30/01/16 19:49:56,000 kernel[0]: IOBluetoothHostController::CreateDeviceReporter -- device = = 0x3c00 
30/01/16 19:49:56,099 blued[87]: Device Connected with address: XX-XX-XX-XX-XX-XX and classOfDevice 0x240404 and connectionHandle 0x000c
30/01/16 19:49:56,000 kernel[0]: BT: returning false because owner <ptr> does not match new owner <ptr>
30/01/16 19:49:56,384 AVRCPAgent[2279]: Setting the delegate returned 0
30/01/16 19:49:56,388 blued[87]: Trigger core audio to connect to bluetoothaudiod
30/01/16 19:49:56,000 kernel[0]: Setting BTCoex Config: enable_2G:1, profile_2g:0, enable_5G:1, profile_5G:0

Trying to run AVRCPAgent manually in /Library/Services/AVRCPAgent (no other output):

./AVRCPAgent
Failed to initialize sandbox
2016-01-30 19:50:24.097 AVRCPAgent[2305:142740] BTHSControlPlugin installed
2016-01-30 19:50:24.098 AVRCPAgent[2305:142740] Setting Delegate: <BluetoothAVRCPAgent: 0x7fc982408c90>
2016-01-30 19:50:24.102 AVRCPAgent[2305:142740] Setting the delegate returned 0

how to remove?

Hello James,
for some reason BTHSControl is not working for me. I stupidly forgot to disconnect all bluetooth devices before installing. that might be the reason.
My first attempt would be to uninstall and try again, but i cannot figure out how to remove it.

Would be happy if you can help me out. It seems to be a great application.
Lukas

AVRCPAgent crash on El Capitan

I have tried several times to get this to run now that I've upgraded to 10.11 and simply cannot get it to work. I have run these commands repeatedly just in case there something left behind somewhere:

sudo ./install.sh uninstall old
sudo ./install.sh uninstall
sudo rm -r build
sudo ./install.sh install

After I connect my BT headphones and try pressing the play/pause button I get the following in my system log:

10/19/15 11:11:54.010 AM com.apple.xpc.launchd[1]: (com.bths.AVRCPAgent[91875]) Service exited due to signal: Abort trap: 6
10/19/15 11:11:54.019 AM com.apple.xpc.launchd[1]: (com.apple.ReportCrash.Root[92017]) Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.ReportCrash.DirectoryService
10/19/15 11:11:54.740 AM ReportCrash[92017]: Saved crash report for AVRCPAgent[91875] version 1.0 (1) to /Library/Logs/DiagnosticReports/AVRCPAgent_2015-10-19-111154_Shadow.crash

I am at my wits end on getting this to work again. Attached you will find the log mentioned above. You can find the above-mentioned crash report in this gist.

Use CGEventPost instead of HIDEvent to make it work during sleep

Thanks for this project, and great reverse engineering work!

One improvement: currently the simulated keyboard events are not sent if the display goes to sleep. In fact, it doesn't even wake the computer like it does when the keyboard is normally pressed during sleep. I'm not 100% sure why this is, but it seems like IOHID has some logic about consuming keypresses if display is sleep. There are also other reports of IOHIDPostEvent not working in sleep.

The fix is simple, use CGEventPost, which also ends up making the code a lot shorter

// Simulate the input of a keystroke based on an associated keycode
static void HIDPostAuxKey(int key) {
    // create and send down key event
    NSEvent* key_event = [NSEvent otherEventWithType:NSSystemDefined location:CGPointZero modifierFlags:0xa00 timestamp:0 windowNumber:0 context:0 subtype:8 data1:((key << 16) | (0xa << 8)) data2:-1];
    CGEventPost(0, key_event.CGEvent);
    
    // create and send up key event
    key_event = [NSEvent otherEventWithType:NSSystemDefined location:CGPointZero modifierFlags:0xb00 timestamp:0 windowNumber:0 context:0 subtype:8 data1:((key << 16) | (0xb << 8)) data2:-1];
    CGEventPost(0, key_event.CGEvent);
}

With this, things work as expected.

macOS Sierra Support

It appears that BTHSControl no longer functions with macOS Sierra, as tested with the GM released on September 8th.

Provide binaries

I'm not fully sure if this is possible, but if we could get a pre-compiled version to download on top of the sources that would greatly help.

I now have to download 5gb of Xcode in order to run the install script. Depending on your bandwidth this can means a lot of time.

Does not work on El Capitan

Hey, I was very interested in your project as I own a bluetooth headset with auto play and pause (based on when u remove your headset). This means that iTunes keeps popping up every so often which is a huge pain. I was looking at solutions to this problem and I came across your app. However, it doesnt seem to work on my 2015 Macbook Pro 13' running El Capitan. I don't mind disabling SIP in order to get this working either.

Alternative actions?

Hi, not really an issue, more of a feature request/question!

I'd like to remap one of my buttons to be a mic mute. I have a bit of applescript to set the mic volume to 0 or 100 depending on whether it is already 100 or 0. But could I attach that to the button press code?
I'm guessing that the "if (status == 68)" bit in BTHSControlPlugin.m then calls
HIDPostAuxKey(NX_KEYTYPE_PLAY); in BTHSInterface.m
Can I easily make that jump out to an AppleScript instead or do I need to learn some cocoa ?

Thanks,
Max

(Re)starting BTHSControll after suspend/sleep

Hello,

I installed your tool on my 2013 Mac running OsX Yosemite. I am using the Creative Aurvana Platinum-Headset and the Play, forward, backward buttons are working very well when I'm using the Clementine audio player.

However I have sometimes issues connecting my bluetooth headphones after the mac wakes up from the suspend. It seems to be a common Yosemite problem, and the solution I found lies in turning-off the WiFi and restarting the bluetooth services. Sadly, the BTHSControll is not working after suspend/sleep for me.

If I connect my BT headphones after a start after a power-off an message appears: AVRCPAgent: BTHSControll Bluetooth headset connected This message can be found in the OsX Messages - menu in the top right corner. This message does not appear, when I connect my bluetooth headset after suspend/sleep or after I restart the bluetooth services.

I wonder if there is a way how to restart the BTHSControll manually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.