3

I'm working on a user-space HID device driver and a lot of googling shows that it is recommended to use the HIDAPI library from signal11. I followed all the readme instructions and ran the make command under the Mac directory but I'm not seeing the hidapi.h file I would imagine I would need. Is there another way I'm supposed to bring the library into an xcode project?

Thanks!

Stavros_S
  • 2,145
  • 7
  • 31
  • 75
  • I am not familiar with HIDAPI (I use the HID functions from the IOKit framework that comes with OS X) but generally if you want to include an external library you need one of the following: a) a *.framework bundle that will include the public headers and a dynamically linkable library b) a *.a (static library) or *.dylib (dynamic library) and its public headers So, what did you get from compiling HIDAPI? – Thorsten Karrer Mar 01 '14 at 11:28
  • @ThorstenKarrer I have a hid.c file and a hidapi.h file. If I create a main.c file and just import those two static files in like that and begin using the functions they offer everything works fine. I'm wondering if I can do the same with Objective-C code inside of a xcode project that is entirely obj-c – Stavros_S Mar 06 '14 at 20:49

1 Answers1

0

Try just converting the hid.c file to a .cpp file in which case you won't need the library because you will have the full source code. This worked for me.

I tried first to build an hidapi library with the provided makefile but was surprised to discover that all that resulted was a hid.o file. Not very useful. I then tried instructions that I found here (create-lab-commons) which modified the makefile and then used g++ to generate a hidapi.dylib from the hid.o. But the resulting dylib did not work. You might be able to get it to work though.

Alyoshak
  • 2,696
  • 10
  • 43
  • 70