Closed llloret closed 7 years ago
Hi,
so we are having some issues to build under MinGW, and it is not very clear what we should do.
As part of the work I did, I removed all the Windows HID definitions embedded in hid.c, since they are now already defined in the standard SDK, with hidpi.h, hidsdi.h, etc. So I saw no reason to have them there.
But if we compile on mingw, compilation goes fine, but the linker fails with some undefined references. It seems to me like if we were able to use the standard Windows hid.dll in the mingw flow, then it should be ok, but I do not know enough about mingw to understand if this is possible or not.
I would not like to have to define things in the code, that are already part of a standard header file, because of the duplication of the code, and potential danger to break things in mysterious ways if a declaration does not match the definition in the dll or library.
Any suggestions on how to proceed?
This is now tested to build on Windows (MinGW/VS, OSX) and Linux (Ubuntu Studio 16.04).
[crucialfelix edit] the following PR is now merged so you can skip this step:
To build seamlessly, this PR must be combined with a PR to SC master: https://github.com/supercollider/supercollider/pull/2123
That one can be gotten like this (assuming the sc repo is origin
):
git fetch origin pull/2123/head:hidapiTest
git checkout hidapiTest
Getting the branch in this PR is a bit tricker, because it is in a submodule. You need to be sure first, that the hidapi submodule is already initialized to pull from this hidapi repo in the supercollider org (rather than still from Marijes):
[submodule "external_libraries/hidapi"]
path = external_libraries/hidapi
url = git://github.com/supercollider/hidapi.git
You might additionally need to do these steps to really switch:
`git submodule deinit external_libraries/hidapi`
then delete the folder .git/modules/external_libraries/hidapi (it will be recreated in the next step with fresh data)
`git submodule init`
`git submodule update`
After this you can checkout the hid3.8
branch in the submodule:
cd external_libraries/hidapi
git checkout hid3.8 origin/hid3.8
If you want to return to the old state, just do:
git submodule update
Happy testing!
Note that there are 4 commits on master that are not included in this commit, but have not been added to supercollider yet (supercollider uses the master branch up to hash #078a676). When using this PR those commits will be included and should be considered part of things to be tested. hid3.8 is based on latest master, so those commits will show up in the log right after #078a676
fyi with hub installed I only needed to go into external_libraries/hidapi
and do
hidapi ❯ git checkout https://github.com/supercollider/hidapi/pull/1
Updating supercollider
remote: Counting objects: 95, done.
remote: Total 95 (delta 51), reused 51 (delta 51), pack-reused 44
Unpacking objects: 100% (95/95), done.
From git://github.com/supercollider/hidapi
* [new branch] hid3.8 -> supercollider/hid3.8
Previous HEAD position was 078a676... Merge pull request #1 from timblechmann/topic/msvc_link_fix
Branch supercollider-hid3.8 set up to track remote branch hid3.8 from supercollider.
Switched to a new branch 'supercollider-hid3.8'
Mixed results on OS X. It can find hid devices but cannot open it. I have no experience with HID on SC so maybe it's me.
HID.findAvailable;
-> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (4 -> a HIDInfo(Apple, Inc, Apple Keyboard, IDs:1452, 545, USB_05ac_0221_14120000, , 105, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (0 -> a HIDInfo(, MX Master, IDs:1133, 45074, Bl...etc...
// works fine
HID.postAvailable;
// here is one of them
0: Usage name and page: undefined, GenericDesktop
Vendor name:
Product name: MX Master
Vendor and product ID: 1133, 45074
Path: Bluetooth Low Energy_046d_b012_4e6595f8
Serial Number: 4803F56E51772345
Releasenumber and interfaceNumber: 20, -1
// can find it
HID.findBy(1133, 45074)
-> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (3 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)) ]
// but cannot open it
HID.open(1133, 45074)
HID: path was not set specified yet, chosen the one with path: Bluetooth Low Energy_046d_b012_4e6595f8
HIDAPI : Unable to open device Bluetooth Low Energy_046d_b012_4e6595f8: 1133, 45074
ERROR: HID: Could not open device
-> nil
// let's try the apple keyboard
// finds it
~myhid = HID.findBy(1452, 611)
-> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (3 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)) ]
// but cannot open it
~myhid = HID.open(1452, 611)
HID: path was not set specified yet, chosen the one with path: USB_05ac_0263_14400000
HIDAPI : Unable to open device USB_05ac_0263_14400000: 1452, 611
ERROR: HID: Could not open device
On 20/08/2016, at 12:51 , Chris Sattinger notifications@github.com wrote:
Mixed results on OS X. It can find hid devices but cannot open it. I have no experience with HID on SC so maybe it's me.
no, this does not look right. I’ll try to look into it soon, best a
HID.findAvailable;
-> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (4 -> a HIDInfo(Apple, Inc, Apple Keyboard, IDs:1452, 545, USB_05ac_0221_14120000, , 105, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (0 -> a HIDInfo(, MX Master, IDs:1133, 45074, Bl...etc...
// works fine
HID.postAvailable;// here is one of them
0: Usage name and page: undefined, GenericDesktop Vendor name:
Product name: MX Master Vendor and product ID: 1133, 45074 Path: Bluetooth Low Energy_046d_b012_4e6595f8 Serial Number: 4803F56E51772345 Releasenumber and interfaceNumber: 20, -1// can find it HID.findBy(1133, 45074)
-> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (3 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)) ]
// but cannot open it HID.open(1133, 45074)
HID: path was not set specified yet, chosen the one with path: Bluetooth Low Energy_046d_b012_4e6595f8 HIDAPI : Unable to open device Bluetooth Low Energy_046d_b012_4e6595f8: 1133, 45074 ERROR: HID: Could not open device -> nil
// let's try the apple keyboard // finds it ~myhid = HID.findBy(1452, 611) -> IdentityDictionary[ (1 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (5 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (2 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)), (3 -> a HIDInfo(Apple Inc., Apple Internal Keyboard / Trackpad, IDs:1452, 611, USB_05ac_0263_14400000, , 549, -1)) ]
// but cannot open it ~myhid = HID.open(1452, 611)
HID: path was not set specified yet, chosen the one with path: USB_05ac_0263_14400000 HIDAPI : Unable to open device USB_05ac_0263_14400000: 1452, 611 ERROR: HID: Could not open device
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I also tried it by specifying the path string. no worky
What's the plan to move forward on this? I don't have access to a Mac, so can't do much... Luis
This is a blocker for 3.8
@adcxyz can you quit your day job and devote yourself 110% to supercollider ? thankx !
just got back from 2 weeks of holidays, sorry I dont get this to compile on my machine, is there a travis build with it that I can download and try?
best adc
On 07/09/2016, at 09:58 , Chris Sattinger notifications@github.com wrote:
This is a blocker for 3.8
@adcxyz can you quit your day job and devote yourself 110% to supercollider ? thankx !
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
ok, got build to work again and tested on OSX 10.11.6 - works.
// test code with HID:
// attach a gamepad
HID.findAvailable;
// look for its number
HID.postAvailable;
// open at that number
d = HID.openAt(2);
// -> should say that device opened
// turn on debug
d.debug = true;
// -> should post a list on thumbstick move, button press etc
// test code with modality:
MKtl.find;
// -> posts variants of creation code, e.g. for an unknown gamepad:
MKtl('hid_5_usb_jo', 'hid_5_usb_joystick_');
so I think we can safely merge this one
So it was me that didn't know how to use it ?
d = HID.openAt(2);
vs
d = HID.open(2);
or
HID.findById
?
Are the docs out of date ? (not that I ever read the documentation ;) )
now we have to switch supercollider's submodule
Ok, so who can do that?
I think I just created the PR ;)
Noticed one more thing when compiling current master with this PR :
@bagong :
thanks, best adc
On 08/09/2016, at 12:42 , Rainer Schütz notifications@github.com wrote:
I think I just created the PR ;)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Oooo, I hoped everything was fine after your okay yesterday.... Okay, I'll have a look. I vaguely remember now something was still pending because the changes are split between the submodule and master...
Maybe you just didn't update the submodule in SC master? Currently (before the PR that updates the pointer to the hidapi submodule is committed) you'd have to do:
git pull origin master
while in the folder external_modules/hidapi
I do get this folder-structure in a clean build (but I am not 100% sure atm how it should be):
This PR brings initial HID support for Windows. At the moment it is only HID input, and the plan is to add output, and feature in the near future.
The idea of this first PR is to serve as a base for initial discussion to see what’s the best way to have Windows support on SC again. Disclaimer: before this effort, I had no idea of HID, so there might be things that are way off. Please be patient with me ;). The commits in the PR follow the development history, they are not completely organised by feature, but almost.
Some important points: