Merge lp:~jus/mixxx/skin-button-feedback into lp:~mixxxdevelopers/mixxx/1.11-skins

Proposed by jus
Status: Merged
Merged at revision: 3131
Proposed branch: lp:~jus/mixxx/skin-button-feedback
Merge into: lp:~mixxxdevelopers/mixxx/1.11-skins
Diff against target: 567542 lines (+294312/-142994)
611 files modified
mixxx/SConstruct (+1/-0)
mixxx/build/debian/changelog (+6/-0)
mixxx/build/debian/control.precise (+23/-0)
mixxx/build/depends.py (+206/-80)
mixxx/build/features.py (+74/-18)
mixxx/build/mixxx.py (+7/-0)
mixxx/build/nsis/Mixxx.nsi (+8/-6)
mixxx/build/osx/OSConsX.py (+49/-15)
mixxx/build/osx/otool.py (+9/-2)
mixxx/build/qt4.py (+1/-0)
mixxx/build/util.py (+14/-1)
mixxx/lib/hidapi-0.7.0/LICENSE-orig.txt (+0/-9)
mixxx/lib/hidapi-0.7.0/LICENSE.txt (+0/-13)
mixxx/lib/hidapi-0.7.0/hidapi/hidapi.h (+0/-383)
mixxx/lib/hidapi-0.7.0/linux/.gitignore (+0/-13)
mixxx/lib/hidapi-0.7.0/linux/Makefile (+0/-36)
mixxx/lib/hidapi-0.7.0/linux/README.txt (+0/-63)
mixxx/lib/hidapi-0.7.0/linux/hid-libusb.c (+0/-1399)
mixxx/lib/hidapi-0.7.0/linux/hid.c (+0/-595)
mixxx/lib/hidapi-0.7.0/mac/.gitignore (+0/-13)
mixxx/lib/hidapi-0.7.0/mac/Makefile (+0/-32)
mixxx/lib/hidapi-0.7.0/mac/hid.c (+0/-1122)
mixxx/lib/hidapi-0.7.0/windows/.gitignore (+0/-11)
mixxx/lib/hidapi-0.7.0/windows/Makefile (+0/-14)
mixxx/lib/hidapi-0.7.0/windows/Makefile.mingw (+0/-32)
mixxx/lib/hidapi-0.7.0/windows/ddk_build/.gitignore (+0/-2)
mixxx/lib/hidapi-0.7.0/windows/ddk_build/hidapi.def (+0/-17)
mixxx/lib/hidapi-0.7.0/windows/ddk_build/makefile (+0/-49)
mixxx/lib/hidapi-0.7.0/windows/ddk_build/sources (+0/-23)
mixxx/lib/hidapi-0.7.0/windows/hid.c (+0/-873)
mixxx/lib/hidapi-0.7.0/windows/hidapi.sln (+0/-29)
mixxx/lib/hidapi-0.7.0/windows/hidapi.vcproj (+0/-201)
mixxx/lib/hidapi-0.7.0/windows/hidtest.vcproj (+0/-196)
mixxx/lib/hidapi-0.8.0-pre/AUTHORS.txt (+16/-0)
mixxx/lib/hidapi-0.8.0-pre/HACKING.txt (+15/-0)
mixxx/lib/hidapi-0.8.0-pre/LICENSE-bsd.txt (+26/-0)
mixxx/lib/hidapi-0.8.0-pre/LICENSE-gpl3.txt (+674/-0)
mixxx/lib/hidapi-0.8.0-pre/LICENSE-orig.txt (+9/-0)
mixxx/lib/hidapi-0.8.0-pre/LICENSE.txt (+13/-0)
mixxx/lib/hidapi-0.8.0-pre/README.txt (+153/-0)
mixxx/lib/hidapi-0.8.0-pre/hidapi/hidapi.h (+383/-0)
mixxx/lib/hidapi-0.8.0-pre/linux/Makefile (+36/-0)
mixxx/lib/hidapi-0.8.0-pre/linux/README.txt (+63/-0)
mixxx/lib/hidapi-0.8.0-pre/linux/hid-libusb.c (+1387/-0)
mixxx/lib/hidapi-0.8.0-pre/linux/hid.c (+601/-0)
mixxx/lib/hidapi-0.8.0-pre/mac/Makefile (+32/-0)
mixxx/lib/hidapi-0.8.0-pre/mac/hid.c (+1150/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/Makefile (+14/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/Makefile.mingw (+32/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/ddk_build/hidapi.def (+17/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/ddk_build/makefile (+49/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/ddk_build/sources (+23/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/hid.c (+893/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/hidapi.sln (+29/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/hidapi.vcproj (+201/-0)
mixxx/lib/hidapi-0.8.0-pre/windows/hidtest.vcproj (+196/-0)
mixxx/lib/replaygain/replaygain.cpp (+374/-0)
mixxx/lib/replaygain/replaygain.h (+110/-0)
mixxx/lib/replaygain/replaygain_analysis.c (+0/-431)
mixxx/lib/replaygain/replaygain_analysis.h (+0/-58)
mixxx/lib/vamp-2.3/src/vamp-hostsdk/PluginLoader.cpp (+3/-3)
mixxx/lib/xwax/debug.h (+33/-0)
mixxx/lib/xwax/lut.c (+11/-10)
mixxx/lib/xwax/lut.cpp (+10/-9)
mixxx/lib/xwax/lut.h (+8/-8)
mixxx/lib/xwax/pitch.h (+8/-8)
mixxx/lib/xwax/timecoder.c (+236/-155)
mixxx/lib/xwax/timecoder.h (+58/-50)
mixxx/lib/xwax/timecoder_win32.cpp (+235/-152)
mixxx/res/controllers/Akai MPD24.midi.xml (+3/-0)
mixxx/res/controllers/American Audio RADIUS 2000 CH1.midi.xml (+2/-42)
mixxx/res/controllers/American Audio RADIUS 2000 CH2.midi.xml (+2/-42)
mixxx/res/controllers/American Audio VMS4.midi.xml (+1/-0)
mixxx/res/controllers/American-Audio-VMS4-scripts.js (+1/-4)
mixxx/res/controllers/Behringer BCD2000.midi.xml (+646/-0)
mixxx/res/controllers/Behringer BCD3000.midi.xml (+3/-48)
mixxx/res/controllers/Behringer-BCD20000-scripts.js (+135/-0)
mixxx/res/controllers/BindableConfigKeys.txt (+0/-117)
mixxx/res/controllers/DJ-Tech CDJ-101.midi.xml (+196/-0)
mixxx/res/controllers/DJ-Tech DJM-101.midi.xml (+204/-0)
mixxx/res/controllers/DJ-Tech Mix-101.midi.xml (+355/-0)
mixxx/res/controllers/DJ-Tech i-Mix Reload.midi.xml (+3/-0)
mixxx/res/controllers/DJ-Tech-CDJ-101-scripts.js (+245/-0)
mixxx/res/controllers/DJ-Tech-DJM-101-scripts.js (+110/-0)
mixxx/res/controllers/DJTechTools MIDI Fighter.midi.xml (+1/-1)
mixxx/res/controllers/Denon MC3000.midi.xml (+338/-57)
mixxx/res/controllers/Denon-MC3000-scripts.js (+59/-41)
mixxx/res/controllers/EKS Otus.hid.xml (+10/-5)
mixxx/res/controllers/EKS Otus.js (+0/-95)
mixxx/res/controllers/EKS-Otus.js (+789/-0)
mixxx/res/controllers/Evolution_Xsession.midi.xml (+2/-2)
mixxx/res/controllers/FaderFoxDJ2.midi.xml (+4/-4)
mixxx/res/controllers/HID Keyboard.hid.xml.example (+18/-0)
mixxx/res/controllers/HID Trackpad.hid.xml.example (+18/-0)
mixxx/res/controllers/HID-Keyboard.js (+30/-0)
mixxx/res/controllers/HID-Trackpad.js (+32/-0)
mixxx/res/controllers/Hercules DJ Console 4-Mx.midi.xml (+912/-0)
mixxx/res/controllers/Hercules DJ Console Mac Edition.midi.xml (+2/-2)
mixxx/res/controllers/Hercules DJ Console Mk2.hid.xml (+13/-0)
mixxx/res/controllers/Hercules DJ Console Mk4.midi.xml (+0/-45)
mixxx/res/controllers/Hercules DJ Control AIR.midi.xml (+941/-0)
mixxx/res/controllers/Hercules DJ Control MP3 e2.bulk.xml (+15/-0)
mixxx/res/controllers/Hercules DJ Control MP3 e2.midi.xml (+10/-74)
mixxx/res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js (+614/-0)
mixxx/res/controllers/Hercules-DJ-Control-AIR-scripts.js (+163/-0)
mixxx/res/controllers/Hercules-mp3e2-compat.js (+178/-0)
mixxx/res/controllers/Ion Discover DJ.midi.xml (+4/-2)
mixxx/res/controllers/M-Audio_Xponent.midi.xml (+113/-113)
mixxx/res/controllers/M-Audio_Xsession_pro.midi.xml (+2/-2)
mixxx/res/controllers/Midi-Keyboard.midi.xml (+2/-2)
mixxx/res/controllers/MidiTech-MidiControl.midi.xml (+2/-2)
mixxx/res/controllers/Mixman DM2 (Linux).midi.xml (+2/-0)
mixxx/res/controllers/Mixman DM2 (OS X).midi.xml (+2/-0)
mixxx/res/controllers/Mixman DM2 (Windows).midi.xml (+2/-2)
mixxx/res/controllers/Nintendo Wiimote.hid.xml (+19/-0)
mixxx/res/controllers/Nintendo-Wiimote.js (+915/-0)
mixxx/res/controllers/Novation Dicer.midi.xml (+969/-0)
mixxx/res/controllers/Novation Launchpad.midi.xml (+736/-0)
mixxx/res/controllers/Novation-Dicer-scripts.js (+387/-0)
mixxx/res/controllers/Novation-Launchpad-scripts.js (+813/-0)
mixxx/res/controllers/Numark DJ2Go.midi.xml (+458/-0)
mixxx/res/controllers/Numark MIXTRACK.midi.xml (+114/-108)
mixxx/res/controllers/Numark Mixtrack Pro.midi.xml (+767/-0)
mixxx/res/controllers/Numark N4.midi.xml (+817/-0)
mixxx/res/controllers/Numark NS7.midi.xml (+1/-1)
mixxx/res/controllers/Numark Omni Control.midi.xml (+909/-0)
mixxx/res/controllers/Numark-DJ2Go-scripts.js (+122/-0)
mixxx/res/controllers/Numark-MixTrack-scripts.js (+226/-208)
mixxx/res/controllers/Numark-Mixtrack-Pro-scripts.js (+531/-0)
mixxx/res/controllers/Numark-N4-scripts.js (+213/-0)
mixxx/res/controllers/Numark-Omni-Control-scripts.js (+483/-0)
mixxx/res/controllers/Pioneer CDJ HID.hid.xml (+24/-0)
mixxx/res/controllers/Pioneer CDJ-2000.midi.xml (+13/-39)
mixxx/res/controllers/Pioneer CDJ-850.midi.xml (+33/-99)
mixxx/res/controllers/Pioneer-CDJ-HID.js (+781/-0)
mixxx/res/controllers/README.txt (+20/-5)
mixxx/res/controllers/Reloop TerminalMix4.js (+409/-0)
mixxx/res/controllers/Reloop TerminalMix4.midi.xml (+3601/-0)
mixxx/res/controllers/Sony SixxAxis.hid.xml (+18/-0)
mixxx/res/controllers/Sony-SixxAxis.js (+305/-0)
mixxx/res/controllers/Stanton SCS.1d.midi.xml (+5/-4)
mixxx/res/controllers/Stanton SCS.1m.midi.xml (+1/-0)
mixxx/res/controllers/Stanton SCS.3d.midi.xml (+204/-189)
mixxx/res/controllers/Stanton SCS.3m.midi.xml (+1/-0)
mixxx/res/controllers/Stanton-SCS1d-scripts.js (+43/-15)
mixxx/res/controllers/TrakProDJ iPad.midi.xml (+1/-1)
mixxx/res/controllers/Traktor Kontrol F1.hid.xml (+18/-0)
mixxx/res/controllers/Traktor Kontrol X1.midi.xml (+111/-0)
mixxx/res/controllers/Traktor-Kontrol-F1-scripts.js (+788/-0)
mixxx/res/controllers/Traktor-Kontrol-X1.js (+325/-0)
mixxx/res/controllers/Vestax VCI-100-hile.midi.xml (+102/-0)
mixxx/res/controllers/Vestax VCI-100.midi.xml (+0/-6)
mixxx/res/controllers/Vestax-VCI-100-hile.js (+539/-0)
mixxx/res/controllers/common-bulk-midi.js (+5/-0)
mixxx/res/controllers/common-controller-scripts.js (+137/-16)
mixxx/res/controllers/common-hid-devices.js (+79/-0)
mixxx/res/controllers/common-hid-packet-parser.js (+1533/-0)
mixxx/res/images/templates/ic_template_keyboard_mapping_sheet.svg (+4199/-6514)
mixxx/res/images/templates/ic_template_library_and_preferences.svg (+122/-97)
mixxx/res/keyboard/cs_CZ.kbd.cfg (+101/-0)
mixxx/res/keyboard/da_DK.kbd.cfg (+101/-0)
mixxx/res/keyboard/de_DE.kbd.cfg (+101/-0)
mixxx/res/keyboard/el_GR.kbd.cfg (+101/-0)
mixxx/res/keyboard/es_ES.kbd.cfg (+101/-0)
mixxx/res/keyboard/fi_FI.kbd.cfg (+101/-0)
mixxx/res/keyboard/fr_FR.kbd.cfg (+101/-0)
mixxx/res/keyboard/it_IT.kbd.cfg (+101/-0)
mixxx/res/keyboard/ru_RU.kbd.cfg (+101/-0)
mixxx/res/mixxx.qrc (+5/-0)
mixxx/res/skins/Deere1280x1024-SXGA/CHANGELOG.txt (+32/-1)
mixxx/res/skins/Deere1280x1024-SXGA/skin.xml (+482/-827)
mixxx/res/skins/Deere1280x800-WXGA/CHANGELOG.txt (+32/-1)
mixxx/res/skins/Deere1280x800-WXGA/skin.xml (+491/-836)
mixxx/res/skins/Deere1366x768-WXGA/CHANGELOG.txt (+198/-0)
mixxx/res/skins/Deere1366x768-WXGA/skin.xml (+5683/-0)
mixxx/res/skins/Deere1440x900-WXGA+/CHANGELOG.txt (+32/-1)
mixxx/res/skins/Deere1440x900-WXGA+/skin.xml (+482/-827)
mixxx/res/skins/Deere1920x1080-FullHD/CHANGELOG.txt (+32/-1)
mixxx/res/skins/Deere1920x1080-FullHD/skin.xml (+482/-827)
mixxx/res/skins/Deere1920x1200-WUXGA/CHANGELOG.txt (+32/-1)
mixxx/res/skins/Deere1920x1200-WUXGA/skin.xml (+482/-827)
mixxx/res/skins/LateNight1280x1024-SXGA/CHANGELOG.txt (+31/-1)
mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml (+468/-903)
mixxx/res/skins/LateNight1280x800-WXGA/CHANGELOG.txt (+31/-1)
mixxx/res/skins/LateNight1280x800-WXGA/skin.xml (+468/-903)
mixxx/res/skins/LateNight1366x768-WXGA/CHANGELOG.txt (+30/-0)
mixxx/res/skins/LateNight1366x768-WXGA/skin.xml (+468/-903)
mixxx/res/skins/LateNightBlues1280x1024-SXGA/CHANGELOG.txt (+31/-1)
mixxx/res/skins/LateNightBlues1280x1024-SXGA/skin.xml (+467/-902)
mixxx/res/skins/LateNightBlues1280x800-WXGA/CHANGELOG.txt (+31/-1)
mixxx/res/skins/LateNightBlues1280x800-WXGA/skin.xml (+467/-902)
mixxx/res/skins/LateNightBlues1366x768-WXGA/CHANGELOG.txt (+31/-1)
mixxx/res/skins/LateNightBlues1366x768-WXGA/skin.xml (+467/-902)
mixxx/res/skins/Outline1024x600-Netbook/CHANGELOG.txt (+31/-0)
mixxx/res/skins/Outline1024x600-Netbook/skin.xml (+2773/-925)
mixxx/res/skins/Outline1024x768-XGA/CHANGELOG.txt (+31/-0)
mixxx/res/skins/Outline1024x768-XGA/skin.xml (+2774/-926)
mixxx/res/skins/Outline800x480-WVGA/CHANGELOG.txt (+21/-0)
mixxx/res/skins/Outline800x480-WVGA/skin.xml (+3643/-998)
mixxx/res/skins/Phoney1600x1200-UXGA/CHANGELOG.txt (+12/-1)
mixxx/res/skins/Phoney1600x1200-UXGA/skin.xml (+97/-591)
mixxx/res/skins/Phoney1680x1050-WSXGA/CHANGELOG.txt (+12/-1)
mixxx/res/skins/Phoney1680x1050-WSXGA/skin.xml (+97/-591)
mixxx/res/skins/PhoneyDark1600x1200-UXGA/CHANGELOG.txt (+12/-1)
mixxx/res/skins/PhoneyDark1600x1200-UXGA/skin.xml (+104/-598)
mixxx/res/skins/PhoneyDark1680x1050-WSXGA/CHANGELOG.txt (+12/-1)
mixxx/res/skins/PhoneyDark1680x1050-WSXGA/skin.xml (+104/-598)
mixxx/res/skins/Shade1024x600-Netbook/CHANGELOG.txt (+30/-1)
mixxx/res/skins/Shade1024x600-Netbook/skin.xml (+498/-897)
mixxx/res/skins/Shade1024x768-XGA/CHANGELOG.txt (+30/-1)
mixxx/res/skins/Shade1024x768-XGA/skin.xml (+500/-899)
mixxx/res/skins/ShadeDark1024x600-Netbook/CHANGELOG.txt (+30/-1)
mixxx/res/skins/ShadeDark1024x600-Netbook/skin.xml (+510/-909)
mixxx/res/skins/ShadeDark1024x768-XGA/CHANGELOG.txt (+30/-1)
mixxx/res/skins/ShadeDark1024x768-XGA/skin.xml (+498/-897)
mixxx/res/translations/mixxx.ts (+868/-497)
mixxx/res/translations/mixxx/ar.po (+1923/-1019)
mixxx/res/translations/mixxx/ast.po (+2321/-1193)
mixxx/res/translations/mixxx/bg.po (+2735/-1168)
mixxx/res/translations/mixxx/br.po (+1891/-1012)
mixxx/res/translations/mixxx/bs.po (+2136/-1072)
mixxx/res/translations/mixxx/ca.po (+2774/-1179)
mixxx/res/translations/mixxx/cs.po (+2716/-1198)
mixxx/res/translations/mixxx/da.po (+1900/-1020)
mixxx/res/translations/mixxx/de.po (+2844/-1154)
mixxx/res/translations/mixxx/el.po (+2419/-1142)
mixxx/res/translations/mixxx/en_GB.po (+2854/-1193)
mixxx/res/translations/mixxx/eo.po (+1906/-1020)
mixxx/res/translations/mixxx/es.po (+2774/-1180)
mixxx/res/translations/mixxx/et.po (+2143/-1091)
mixxx/res/translations/mixxx/eu.po (+2426/-1130)
mixxx/res/translations/mixxx/fi.po (+3027/-1439)
mixxx/res/translations/mixxx/fr.po (+2901/-1196)
mixxx/res/translations/mixxx/ga.po (+1899/-1016)
mixxx/res/translations/mixxx/gl.po (+2376/-1117)
mixxx/res/translations/mixxx/he.po (+1983/-1034)
mixxx/res/translations/mixxx/hu.po (+2268/-1102)
mixxx/res/translations/mixxx/hy.po (+1877/-1010)
mixxx/res/translations/mixxx/ia.po (+1884/-1011)
mixxx/res/translations/mixxx/id.po (+1899/-1016)
mixxx/res/translations/mixxx/is.po (+2214/-1090)
mixxx/res/translations/mixxx/it.po (+2735/-1172)
mixxx/res/translations/mixxx/ja.po (+2701/-1173)
mixxx/res/translations/mixxx/lb.po (+2124/-1066)
mixxx/res/translations/mixxx/mixxx.pot (+597/-314)
mixxx/res/translations/mixxx/ml.po (+2046/-1051)
mixxx/res/translations/mixxx/mn.po (+1899/-1016)
mixxx/res/translations/mixxx/mr.po (+1895/-1016)
mixxx/res/translations/mixxx/ms.po (+1899/-1016)
mixxx/res/translations/mixxx/nb.po (+2329/-1111)
mixxx/res/translations/mixxx/nl.po (+2711/-1181)
mixxx/res/translations/mixxx/nn.po (+1928/-1020)
mixxx/res/translations/mixxx/oc.po (+2223/-1082)
mixxx/res/translations/mixxx/pl.po (+2675/-1168)
mixxx/res/translations/mixxx/pt.po (+2374/-1163)
mixxx/res/translations/mixxx/pt_BR.po (+2699/-1203)
mixxx/res/translations/mixxx/ro.po (+2287/-1110)
mixxx/res/translations/mixxx/ru.po (+2753/-1184)
mixxx/res/translations/mixxx/sl.po (+1899/-1016)
mixxx/res/translations/mixxx/sr.po (+1939/-1059)
mixxx/res/translations/mixxx/sv.po (+2361/-1119)
mixxx/res/translations/mixxx/te.po (+4397/-0)
mixxx/res/translations/mixxx/tr.po (+1982/-1061)
mixxx/res/translations/mixxx/uk.po (+2769/-1185)
mixxx/res/translations/mixxx/uz.po (+1973/-1032)
mixxx/res/translations/mixxx/zh_CN.po (+2300/-1156)
mixxx/res/translations/mixxx/zh_TW.po (+1877/-1010)
mixxx/res/translations/mixxx_ar.ts (+2044/-1013)
mixxx/res/translations/mixxx_ast.ts (+2194/-1389)
mixxx/res/translations/mixxx_bg.ts (+2128/-907)
mixxx/res/translations/mixxx_br.ts (+2043/-1020)
mixxx/res/translations/mixxx_bs.ts (+2065/-999)
mixxx/res/translations/mixxx_ca.ts (+1987/-903)
mixxx/res/translations/mixxx_cs.ts (+2144/-1003)
mixxx/res/translations/mixxx_da.ts (+2044/-1021)
mixxx/res/translations/mixxx_de.ts (+1687/-880)
mixxx/res/translations/mixxx_el.ts (+2116/-984)
mixxx/res/translations/mixxx_en_GB.ts (+1765/-974)
mixxx/res/translations/mixxx_eo.ts (+2044/-1019)
mixxx/res/translations/mixxx_es.ts (+1999/-918)
mixxx/res/translations/mixxx_et.ts (+2107/-1064)
mixxx/res/translations/mixxx_eu.ts (+2108/-971)
mixxx/res/translations/mixxx_fi.ts (+2162/-1263)
mixxx/res/translations/mixxx_fr.ts (+1718/-910)
mixxx/res/translations/mixxx_ga.ts (+2045/-1021)
mixxx/res/translations/mixxx_gl.ts (+2100/-976)
mixxx/res/translations/mixxx_he.ts (+2058/-1014)
mixxx/res/translations/mixxx_hu.ts (+2079/-984)
mixxx/res/translations/mixxx_hy.ts (+2043/-1024)
mixxx/res/translations/mixxx_ia.ts (+2045/-1024)
mixxx/res/translations/mixxx_id.ts (+2045/-1021)
mixxx/res/translations/mixxx_is.ts (+2085/-991)
mixxx/res/translations/mixxx_it.ts (+2129/-905)
mixxx/res/translations/mixxx_ja.ts (+2129/-971)
mixxx/res/translations/mixxx_lb.ts (+2059/-995)
mixxx/res/translations/mixxx_ml.ts (+2060/-1005)
mixxx/res/translations/mixxx_mn.ts (+2045/-1021)
mixxx/res/translations/mixxx_mr.ts (+2043/-1020)
mixxx/res/translations/mixxx_ms.ts (+2045/-1021)
mixxx/res/translations/mixxx_nb.ts (+2088/-978)
mixxx/res/translations/mixxx_nl.ts (+2141/-932)
mixxx/res/translations/mixxx_nn.ts (+2044/-1012)
mixxx/res/translations/mixxx_oc.ts (+2086/-997)
mixxx/res/translations/mixxx_pl.ts (+2117/-925)
mixxx/res/translations/mixxx_pt.ts (+2135/-1160)
mixxx/res/translations/mixxx_pt_BR.ts (+2147/-1006)
mixxx/res/translations/mixxx_ro.ts (+2091/-991)
mixxx/res/translations/mixxx_ru.ts (+2115/-924)
mixxx/res/translations/mixxx_sl.ts (+2045/-1021)
mixxx/res/translations/mixxx_sr.ts (+2057/-1095)
mixxx/res/translations/mixxx_sv.ts (+2108/-993)
mixxx/res/translations/mixxx_te.ts (+5160/-0)
mixxx/res/translations/mixxx_tr.ts (+2075/-1062)
mixxx/res/translations/mixxx_uk.ts (+2133/-959)
mixxx/res/translations/mixxx_uz.ts (+2049/-1016)
mixxx/res/translations/mixxx_zh_CN.ts (+2102/-1084)
mixxx/res/translations/mixxx_zh_TW.ts (+2043/-1024)
mixxx/src/SConscript (+217/-93)
mixxx/src/SConscript.env (+11/-11)
mixxx/src/analyserbeats.cpp (+0/-2)
mixxx/src/analysergainvamp.cpp (+0/-90)
mixxx/src/analysergainvamp.h (+0/-31)
mixxx/src/analyserqueue.cpp (+21/-32)
mixxx/src/analyserrg.cpp (+28/-27)
mixxx/src/analyserrg.h (+4/-1)
mixxx/src/analyserwaveform.cpp (+105/-89)
mixxx/src/analyserwaveform.h (+28/-9)
mixxx/src/basetrackplayer.cpp (+5/-1)
mixxx/src/cachingreader.cpp (+87/-39)
mixxx/src/configobject.cpp (+46/-39)
mixxx/src/configobject.h (+4/-3)
mixxx/src/controllers/bulk/bulkcontroller.cpp (+249/-0)
mixxx/src/controllers/bulk/bulkcontroller.h (+107/-0)
mixxx/src/controllers/bulk/bulkenumerator.cpp (+64/-0)
mixxx/src/controllers/bulk/bulkenumerator.h (+27/-0)
mixxx/src/controllers/bulk/bulksupported.h (+24/-0)
mixxx/src/controllers/controller.cpp (+17/-21)
mixxx/src/controllers/controller.h (+16/-4)
mixxx/src/controllers/controllerengine.cpp (+478/-183)
mixxx/src/controllers/controllerengine.h (+74/-14)
mixxx/src/controllers/controllermanager.cpp (+49/-38)
mixxx/src/controllers/controllermanager.h (+6/-1)
mixxx/src/controllers/controllerpreset.h (+25/-0)
mixxx/src/controllers/controllerpresetfilehandler.cpp (+10/-0)
mixxx/src/controllers/controllerpresetinfo.cpp (+250/-0)
mixxx/src/controllers/controllerpresetinfo.h (+93/-0)
mixxx/src/controllers/defs_controllers.h (+15/-14)
mixxx/src/controllers/dlgcontrollerlearning.cpp (+38/-19)
mixxx/src/controllers/dlgprefcontroller.cpp (+83/-13)
mixxx/src/controllers/dlgprefcontroller.h (+7/-1)
mixxx/src/controllers/dlgprefcontrollerdlg.ui (+160/-35)
mixxx/src/controllers/hid/hidblacklist.h (+21/-0)
mixxx/src/controllers/hid/hidcontroller.cpp (+132/-33)
mixxx/src/controllers/hid/hidcontroller.h (+10/-1)
mixxx/src/controllers/hid/hidenumerator.cpp (+64/-4)
mixxx/src/controllers/midi/hss1394controller.cpp (+1/-1)
mixxx/src/controllers/midi/midicontroller.cpp (+50/-14)
mixxx/src/controllers/midi/midicontroller.h (+3/-1)
mixxx/src/controllers/midi/midioutputhandler.cpp (+3/-0)
mixxx/src/controllers/midi/portmidicontroller.cpp (+69/-59)
mixxx/src/controllers/midi/portmidicontroller.h (+1/-2)
mixxx/src/controllers/softtakeover.cpp (+11/-3)
mixxx/src/controllers/softtakeover.h (+2/-1)
mixxx/src/controlobjectthreadmain.h (+1/-1)
mixxx/src/controlpushbutton.cpp (+13/-13)
mixxx/src/controlvaluedelegate.cpp (+1/-1)
mixxx/src/defs.h (+11/-0)
mixxx/src/defs_version.h (+1/-1)
mixxx/src/dlgautodj.cpp (+159/-76)
mixxx/src/dlgautodj.h (+28/-8)
mixxx/src/dlgprefbeats.cpp (+2/-0)
mixxx/src/dlgprefbpm.cpp (+2/-1)
mixxx/src/dlgprefcontrols.cpp (+68/-49)
mixxx/src/dlgprefcontrols.h (+2/-0)
mixxx/src/dlgprefcontrolsdlg.ui (+69/-60)
mixxx/src/dlgprefcrossfader.cpp (+125/-167)
mixxx/src/dlgprefcrossfader.h (+3/-8)
mixxx/src/dlgprefcrossfaderdlg.ui (+16/-11)
mixxx/src/dlgpreferences.cpp (+7/-0)
mixxx/src/dlgprefplaylist.cpp (+0/-2)
mixxx/src/dlgprefplaylistdlg.ui (+19/-3)
mixxx/src/dlgprefrecord.cpp (+7/-11)
mixxx/src/dlgprefsound.cpp (+13/-1)
mixxx/src/dlgprefsound.h (+3/-0)
mixxx/src/dlgprefsounddlg.ui (+19/-1)
mixxx/src/dlgprefsounditem.cpp (+15/-0)
mixxx/src/dlgprefsounditem.h (+1/-0)
mixxx/src/dlgprepare.cpp (+6/-2)
mixxx/src/dlgprepare.h (+2/-4)
mixxx/src/dlgrecording.cpp (+1/-0)
mixxx/src/dlgrecording.h (+1/-0)
mixxx/src/engine/cuecontrol.cpp (+72/-21)
mixxx/src/engine/cuecontrol.h (+9/-1)
mixxx/src/engine/enginebuffer.cpp (+119/-13)
mixxx/src/engine/enginebuffer.h (+15/-0)
mixxx/src/engine/enginebufferscalelinear.cpp (+9/-2)
mixxx/src/engine/engineclipping.cpp (+18/-4)
mixxx/src/engine/engineclipping.h (+1/-0)
mixxx/src/engine/enginemaster.cpp (+12/-2)
mixxx/src/engine/enginemaster.h (+3/-2)
mixxx/src/engine/enginemicrophone.cpp (+3/-2)
mixxx/src/engine/enginepassthrough.cpp (+3/-2)
mixxx/src/engine/enginepregain.cpp (+13/-5)
mixxx/src/engine/enginepregain.h (+2/-3)
mixxx/src/engine/enginevinylsoundemu.cpp (+6/-6)
mixxx/src/engine/enginexfader.cpp (+43/-33)
mixxx/src/engine/enginexfader.h (+4/-1)
mixxx/src/engine/loopingcontrol.cpp (+39/-3)
mixxx/src/engine/loopingcontrol.h (+7/-0)
mixxx/src/engine/readaheadmanager.cpp (+49/-12)
mixxx/src/engine/readaheadmanager.h (+1/-0)
mixxx/src/library/autodjfeature.cpp (+22/-27)
mixxx/src/library/autodjfeature.h (+2/-2)
mixxx/src/library/baseplaylistfeature.cpp (+56/-4)
mixxx/src/library/baseplaylistfeature.h (+8/-5)
mixxx/src/library/basesqltablemodel.cpp (+37/-9)
mixxx/src/library/basesqltablemodel.h (+2/-0)
mixxx/src/library/basetrackcache.cpp (+64/-25)
mixxx/src/library/basetrackcache.h (+4/-1)
mixxx/src/library/browse/browsefeature.cpp (+9/-8)
mixxx/src/library/browse/browsefeature.h (+2/-3)
mixxx/src/library/browse/browsetablemodel.cpp (+9/-8)
mixxx/src/library/browse/browsetablemodel.h (+5/-7)
mixxx/src/library/browse/foldertreemodel.cpp (+39/-22)
mixxx/src/library/browse/foldertreemodel.h (+8/-4)
mixxx/src/library/cratefeature.cpp (+84/-47)
mixxx/src/library/cratefeature.h (+7/-4)
mixxx/src/library/cratetablemodel.cpp (+1/-8)
mixxx/src/library/cratetablemodel.h (+0/-1)
mixxx/src/library/dao/analysisdao.cpp (+76/-0)
mixxx/src/library/dao/analysisdao.h (+3/-0)
mixxx/src/library/dao/cratedao.cpp (+39/-12)
mixxx/src/library/dao/cratedao.h (+3/-1)
mixxx/src/library/dao/cuedao.cpp (+19/-0)
mixxx/src/library/dao/cuedao.h (+1/-0)
mixxx/src/library/dao/playlistdao.cpp (+132/-49)
mixxx/src/library/dao/playlistdao.h (+20/-14)
mixxx/src/library/dao/trackdao.cpp (+642/-469)
mixxx/src/library/dao/trackdao.h (+38/-25)
mixxx/src/library/featuredartistswebview.cpp (+2/-1)
mixxx/src/library/hiddentablemodel.cpp (+140/-0)
mixxx/src/library/hiddentablemodel.h (+41/-0)
mixxx/src/library/itunes/itunesfeature.cpp (+130/-45)
mixxx/src/library/itunes/itunesfeature.h (+6/-2)
mixxx/src/library/itunes/itunestrackmodel.cpp (+1/-0)
mixxx/src/library/legacylibraryimporter.cpp (+5/-2)
mixxx/src/library/library.cpp (+6/-2)
mixxx/src/library/library.h (+4/-2)
mixxx/src/library/libraryfeature.h (+2/-2)
mixxx/src/library/libraryscanner.cpp (+117/-143)
mixxx/src/library/libraryscanner.h (+10/-9)
mixxx/src/library/libraryscannerdlg.cpp (+4/-1)
mixxx/src/library/librarytablemodel.cpp (+7/-27)
mixxx/src/library/librarytablemodel.h (+0/-4)
mixxx/src/library/missingtablemodel.cpp (+3/-24)
mixxx/src/library/missingtablemodel.h (+1/-4)
mixxx/src/library/mixxxlibraryfeature.cpp (+40/-14)
mixxx/src/library/mixxxlibraryfeature.h (+5/-2)
mixxx/src/library/playlistfeature.cpp (+59/-69)
mixxx/src/library/playlistfeature.h (+4/-2)
mixxx/src/library/playlisttablemodel.cpp (+34/-46)
mixxx/src/library/playlisttablemodel.h (+3/-3)
mixxx/src/library/preparefeature.cpp (+27/-15)
mixxx/src/library/preparefeature.h (+5/-2)
mixxx/src/library/promotracksfeature.cpp (+19/-10)
mixxx/src/library/promotracksfeature.h (+2/-2)
mixxx/src/library/proxytrackmodel.cpp (+4/-3)
mixxx/src/library/proxytrackmodel.h (+1/-1)
mixxx/src/library/queryutil.h (+1/-1)
mixxx/src/library/recording/recordingfeature.cpp (+22/-7)
mixxx/src/library/recording/recordingfeature.h (+2/-3)
mixxx/src/library/rhythmbox/rhythmboxfeature.cpp (+20/-20)
mixxx/src/library/rhythmbox/rhythmboxfeature.h (+2/-2)
mixxx/src/library/schemamanager.cpp (+12/-9)
mixxx/src/library/schemamanager.h (+1/-1)
mixxx/src/library/searchqueryparser.cpp (+9/-4)
mixxx/src/library/setlogfeature.cpp (+70/-59)
mixxx/src/library/setlogfeature.h (+6/-2)
mixxx/src/library/sidebarmodel.cpp (+7/-8)
mixxx/src/library/sidebarmodel.h (+1/-1)
mixxx/src/library/stardelegate.cpp (+40/-7)
mixxx/src/library/stardelegate.h (+12/-6)
mixxx/src/library/stareditor.cpp (+8/-1)
mixxx/src/library/stareditor.h (+9/-8)
mixxx/src/library/starrating.cpp (+9/-3)
mixxx/src/library/starrating.h (+2/-1)
mixxx/src/library/trackcollection.cpp (+79/-85)
mixxx/src/library/trackcollection.h (+4/-9)
mixxx/src/library/trackmodel.h (+20/-2)
mixxx/src/library/traktor/traktorfeature.cpp (+7/-11)
mixxx/src/library/traktor/traktorfeature.h (+2/-2)
mixxx/src/main.cpp (+60/-64)
mixxx/src/mixxx.cpp (+284/-163)
mixxx/src/mixxx.h (+81/-11)
mixxx/src/mixxx.rc (+13/-16)
mixxx/src/mixxxkeyboard.cpp (+26/-19)
mixxx/src/mixxxkeyboard.h (+1/-1)
mixxx/src/playerinfo.cpp (+1/-1)
mixxx/src/playermanager.cpp (+60/-1)
mixxx/src/playermanager.h (+10/-1)
mixxx/src/proto/skin.proto (+18/-0)
mixxx/src/recording/encodermp3.cpp (+2/-3)
mixxx/src/recording/enginerecord.cpp (+1/-1)
mixxx/src/recording/recordingmanager.cpp (+5/-17)
mixxx/src/sharedglcontext.cpp (+4/-8)
mixxx/src/singleton.h (+1/-1)
mixxx/src/skin/legacyskinparser.cpp (+170/-14)
mixxx/src/skin/legacyskinparser.h (+4/-0)
mixxx/src/skin/propertybinder.h (+1/-1)
mixxx/src/skin/skinloader.cpp (+24/-17)
mixxx/src/skin/tooltips.cpp (+15/-3)
mixxx/src/sounddeviceportaudio.cpp (+32/-27)
mixxx/src/sounddeviceportaudio.h (+12/-4)
mixxx/src/soundmanager.cpp (+69/-160)
mixxx/src/soundmanager.h (+47/-12)
mixxx/src/soundmanagerconfig.cpp (+3/-4)
mixxx/src/soundsourceflac.h (+1/-0)
mixxx/src/soundsourcemp3.cpp (+9/-3)
mixxx/src/soundsourceoggvorbis.cpp (+9/-5)
mixxx/src/soundsourceproxy.cpp (+96/-64)
mixxx/src/test/analyserwaveformtest.cpp (+5/-1)
mixxx/src/test/controllerengine_test.cpp (+178/-1)
mixxx/src/test/lcstest.cpp (+36/-0)
mixxx/src/track/beatutils.cpp (+4/-0)
mixxx/src/trackinfoobject.cpp (+8/-10)
mixxx/src/trackinfoobject.h (+3/-5)
mixxx/src/transposeproxymodel.h (+2/-1)
mixxx/src/upgrade.cpp (+7/-7)
mixxx/src/upgrade.h (+1/-1)
mixxx/src/util/fifo.h (+14/-2)
mixxx/src/util/lcs.h (+34/-0)
mixxx/src/util/sleepableqthread.cpp (+8/-0)
mixxx/src/util/sleepableqthread.h (+26/-0)
mixxx/src/vamp/vampanalyser.cpp (+8/-2)
mixxx/src/vinylcontrol/vinylcontrolmanager.cpp (+28/-11)
mixxx/src/vinylcontrol/vinylcontrolxwax.cpp (+13/-4)
mixxx/src/vinylcontrol/vinylcontrolxwax.h (+1/-1)
mixxx/src/waveform/renderers/glslwaveformrenderersignal.cpp (+107/-61)
mixxx/src/waveform/renderers/glslwaveformrenderersignal.h (+10/-12)
mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.cpp (+174/-324)
mixxx/src/waveform/renderers/glwaveformrendererfilteredsignal.h (+3/-34)
mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.cpp (+119/-188)
mixxx/src/waveform/renderers/glwaveformrenderersimplesignal.h (+3/-21)
mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp (+343/-0)
mixxx/src/waveform/renderers/qtwaveformrendererfilteredsignal.h (+35/-0)
mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp (+221/-0)
mixxx/src/waveform/renderers/qtwaveformrenderersimplesignal.h (+30/-0)
mixxx/src/waveform/renderers/waveformmark.cpp (+1/-5)
mixxx/src/waveform/renderers/waveformmark.h (+1/-1)
mixxx/src/waveform/renderers/waveformmarkset.cpp (+62/-0)
mixxx/src/waveform/renderers/waveformmarkset.h (+24/-0)
mixxx/src/waveform/renderers/waveformrenderbackground.cpp (+7/-5)
mixxx/src/waveform/renderers/waveformrenderbackground.h (+0/-1)
mixxx/src/waveform/renderers/waveformrenderbeat.cpp (+2/-1)
mixxx/src/waveform/renderers/waveformrenderbeat.h (+1/-1)
mixxx/src/waveform/renderers/waveformrendererabstract.h (+1/-1)
mixxx/src/waveform/renderers/waveformrendererendoftrack.cpp (+17/-12)
mixxx/src/waveform/renderers/waveformrendererendoftrack.h (+1/-1)
mixxx/src/waveform/renderers/waveformrendererfilteredsignal.cpp (+107/-37)
mixxx/src/waveform/renderers/waveformrendererfilteredsignal.h (+6/-12)
mixxx/src/waveform/renderers/waveformrendererpreroll.cpp (+5/-7)
mixxx/src/waveform/renderers/waveformrendererpreroll.h (+0/-1)
mixxx/src/waveform/renderers/waveformrenderersignalbase.cpp (+83/-0)
mixxx/src/waveform/renderers/waveformrenderersignalbase.h (+38/-0)
mixxx/src/waveform/renderers/waveformrendermark.cpp (+14/-27)
mixxx/src/waveform/renderers/waveformrendermark.h (+2/-3)
mixxx/src/waveform/renderers/waveformrendermarkrange.cpp (+3/-5)
mixxx/src/waveform/renderers/waveformrendermarkrange.h (+0/-1)
mixxx/src/waveform/renderers/waveformwidgetrenderer.cpp (+45/-53)
mixxx/src/waveform/renderers/waveformwidgetrenderer.h (+3/-7)
mixxx/src/waveform/waveform.cpp (+26/-8)
mixxx/src/waveform/waveform.h (+6/-1)
mixxx/src/waveform/waveformfactory.cpp (+24/-2)
mixxx/src/waveform/waveformfactory.h (+14/-0)
mixxx/src/waveform/waveformwidgetfactory.cpp (+165/-88)
mixxx/src/waveform/waveformwidgetfactory.h (+4/-0)
mixxx/src/waveform/widgets/emptywaveformwidget.cpp (+6/-3)
mixxx/src/waveform/widgets/emptywaveformwidget.h (+3/-3)
mixxx/src/waveform/widgets/glsimplewaveformwidget.cpp (+7/-10)
mixxx/src/waveform/widgets/glsimplewaveformwidget.h (+3/-6)
mixxx/src/waveform/widgets/glslwaveformwidget.cpp (+7/-6)
mixxx/src/waveform/widgets/glslwaveformwidget.h (+3/-3)
mixxx/src/waveform/widgets/glwaveformwidget.cpp (+5/-4)
mixxx/src/waveform/widgets/glwaveformwidget.h (+3/-3)
mixxx/src/waveform/widgets/qtsimplewaveformwidget.cpp (+57/-0)
mixxx/src/waveform/widgets/qtsimplewaveformwidget.h (+31/-0)
mixxx/src/waveform/widgets/qtwaveformwidget.cpp (+55/-0)
mixxx/src/waveform/widgets/qtwaveformwidget.h (+30/-0)
mixxx/src/waveform/widgets/softwarewaveformwidget.cpp (+10/-7)
mixxx/src/waveform/widgets/softwarewaveformwidget.h (+3/-3)
mixxx/src/waveform/widgets/waveformwidgetabstract.h (+2/-6)
mixxx/src/waveform/widgets/waveformwidgettype.h (+4/-2)
mixxx/src/widget/wlibrarysidebar.cpp (+16/-52)
mixxx/src/widget/wlibrarytableview.cpp (+3/-4)
mixxx/src/widget/woverview.cpp (+80/-127)
mixxx/src/widget/woverview.h (+7/-5)
mixxx/src/widget/wpushbutton.cpp (+10/-0)
mixxx/src/widget/wsearchlineedit.cpp (+12/-1)
mixxx/src/widget/wslidercomposed.h (+1/-0)
mixxx/src/widget/wspinny.cpp (+42/-107)
mixxx/src/widget/wspinny.h (+74/-69)
mixxx/src/widget/wtracktableview.cpp (+326/-237)
mixxx/src/widget/wtracktableview.h (+7/-1)
mixxx/src/widget/wtracktableviewheader.cpp (+6/-2)
mixxx/src/widget/wwaveformviewer.cpp (+3/-3)
mixxx/src/widget/wwaveformviewer.h (+1/-0)
mixxx/vamp-plugins/SConscript (+0/-1)
mixxx/vamp-plugins/dsp/GetKeyMode.h (+35/-30)
mixxx/vamp-plugins/libmain.cpp (+0/-6)
mixxx/vamp-plugins/plugins/replaygain.cpp (+0/-758)
mixxx/vamp-plugins/plugins/replaygain.h (+0/-109)
To merge this branch: bzr merge lp:~jus/mixxx/skin-button-feedback
Reviewer Review Type Date Requested Status
jus Approve
Review via email: mp+131490@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
jus (jus) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mixxx/SConstruct'
2--- mixxx/SConstruct 2012-04-25 15:40:15 +0000
3+++ mixxx/SConstruct 2012-10-25 21:24:26 +0000
4@@ -38,6 +38,7 @@
5 features.MediaFoundation,
6 features.HSS1394,
7 features.HID,
8+ features.Bulk,
9 features.VinylControl,
10 features.Shoutcast,
11 features.Profiling,
12
13=== modified file 'mixxx/build/debian/changelog'
14--- mixxx/build/debian/changelog 2011-12-26 06:34:29 +0000
15+++ mixxx/build/debian/changelog 2012-10-25 21:24:26 +0000
16@@ -1,3 +1,9 @@
17+mixxx (1.11.0~beta1-0ubuntu1) lucid; urgency=low
18+
19+ * New upstream beta release
20+
21+ -- RJ Ryan <rryan@mixxx.org> Thu, 21 Jun 2012 15:41:22 -0400
22+
23 mixxx (1.10.0-0ubuntu1) lucid; urgency=low
24
25 * New upstream release.
26
27=== added file 'mixxx/build/debian/control.precise'
28--- mixxx/build/debian/control.precise 1970-01-01 00:00:00 +0000
29+++ mixxx/build/debian/control.precise 2012-10-25 21:24:26 +0000
30@@ -0,0 +1,23 @@
31+Source: mixxx
32+Section: sound
33+Priority: optional
34+Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
35+XSBC-Original-Maintainer: RJ Ryan <rryan@mixxx.org>
36+Build-Depends: debhelper (>= 4.0.0), pkg-config, docbook-to-man, libglu1-mesa-dev, libqt4-opengl-dev | libqt4-dev (>= 4.6.0), scons, libjack-dev, portaudio19-dev, libid3tag0-dev, libmad0-dev, libogg-dev, libsndfile1-dev, libasound2-dev, libvorbis-dev, libsoundtouch1-dev, libmp4v2-dev, libfaad-dev, libportmidi-dev, libtag1-dev, libshout-dev, libqtwebkit-dev, vamp-plugin-sdk, libprotobuf-dev, protobuf-compiler, libusb-1.0-0-dev
37+Standards-Version: 3.7.3
38+
39+Package: mixxx
40+Section: sound
41+Architecture: any
42+Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-opengl, libqt4-svg, libqt4-xmlpatterns, libqt4-webkit, libqt4-sql, libqt4-sql-sqlite
43+Recommends: libmp3lame0
44+Suggests: pdf-viewer
45+Replaces: mixxx-data
46+Description: Digital DJ interface
47+ Mixxx allows DJs to perform live mixes with their digital music library. A
48+ robust mixing engine including filters, gains, a crossfader, and pitch control
49+ are provided. Mixxx also features BPM detection to help DJs find the tempo of
50+ songs in their library.
51+ .
52+ Mixxx works with ALSA, JACK, and OSS, and supports many popular DJ controllers
53+ including the Hercules MK2 and M-Audio X-Session Pro.
54
55=== modified file 'mixxx/build/depends.py'
56--- mixxx/build/depends.py 2012-05-11 04:59:33 +0000
57+++ mixxx/build/depends.py 2012-10-25 21:24:26 +0000
58@@ -8,11 +8,17 @@
59 class PortAudio(Dependence):
60
61 def configure(self, build, conf):
62- if not conf.CheckLib('portaudio'):
63+ libs = ['portaudio']
64+ if build.msvcdebug:
65+ libs = ['portaudiod','portaudio-debug']
66+ if not conf.CheckLib(libs):
67 raise Exception('Did not find libportaudio.a, portaudio.lib, or the PortAudio-v19 development header files.')
68
69 #Turn on PortAudio support in Mixxx
70- build.env.Append(CPPDEFINES = '__PORTAUDIO__');
71+ build.env.Append(CPPDEFINES = '__PORTAUDIO__')
72+
73+ if build.platform_is_windows and build.static_dependencies:
74+ conf.CheckLib('advapi32')
75
76 def sources(self, build):
77 return ['sounddeviceportaudio.cpp']
78@@ -20,13 +26,31 @@
79 class PortMIDI(Dependence):
80
81 def configure(self, build, conf):
82- #Check for PortTime
83- if not conf.CheckLib(['porttime', 'libporttime']) and \
84- not conf.CheckHeader(['porttime.h']):
85+ # Check for PortTime
86+ libs = ['porttime', 'libporttime']
87+ headers = ['porttime.h']
88+ if build.msvcdebug:
89+ libs = ['porttimed', 'porttime-debug']
90+
91+ # Depending on the library configuration PortTime might be statically
92+ # linked with PortMidi. We treat either presence of the lib or the
93+ # header as success.
94+ if not conf.CheckLib(libs) and not conf.CheckHeader(headers):
95 raise Exception("Did not find PortTime or its development headers.")
96- if not conf.CheckLib(['portmidi', 'libportmidi']) and \
97- not conf.CheckHeader(['portmidi.h']):
98- raise Exception('Did not find PortMidi or its development headers.')
99+
100+ # Check for PortMidi
101+ libs = ['portmidi', 'libportmidi']
102+ headers = ['portmidi.h']
103+ if build.platform_is_windows:
104+ # We have this special branch here because on Windows we might want
105+ # to link PortMidi statically which we don't want to do on other
106+ # platforms.
107+ if build.msvcdebug:
108+ libs = ['portmidi_sd', 'portmidi_s-debug', 'portmidid', 'portmidi-debug']
109+ else:
110+ libs = ['portmidi_s','portmidi', 'libportmidi']
111+ if not conf.CheckLib(libs) or not conf.CheckHeader(headers):
112+ raise Exception("Did not find PortMidi or its development headers.")
113
114 def sources(self, build):
115 return ['controllers/midi/portmidienumerator.cpp', 'controllers/midi/portmidicontroller.cpp']
116@@ -40,12 +64,12 @@
117 not conf.CheckLib('opengl32') and
118 not conf.CheckCHeader('/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/gl.h') and
119 not conf.CheckCHeader('GL/gl.h')):
120- raise Exception('Did not find OpenGL development files, exiting!')
121+ raise Exception('Did not find OpenGL development files')
122
123 if (not conf.CheckLib('GLU') and
124 not conf.CheckLib('glu32') and
125 not conf.CheckCHeader('/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/glu.h')):
126- raise Exception('Did not find GLU development files, exiting!')
127+ raise Exception('Did not find GLU development files')
128
129 if build.platform_is_osx:
130 build.env.Append(CPPPATH='/Library/Frameworks/OpenGL.framework/Headers/')
131@@ -61,15 +85,33 @@
132 # if not conf.CheckLib('vorbisfile_static'):
133 # raise Exception('Did not find vorbisfile_static.lib or the libvorbisfile development headers.')
134 # else:
135- if not conf.CheckLib(['libvorbisfile', 'vorbisfile']):
136+ libs = ['libvorbisfile', 'vorbisfile']
137+ if build.platform_is_windows:
138+ if build.msvcdebug:
139+ libs = ['libvorbisfile_static-debug','vorbisfile_static-debug','vorbisfile-debug','libvorbisfile-debug']
140+ else:
141+ libs = ['libvorbisfile', 'vorbisfile', 'libvorbisfile_static', 'vorbisfile_static']
142+ if not conf.CheckLib(libs):
143 Exception('Did not find libvorbisfile.a, libvorbisfile.lib, '
144- 'or the libvorbisfile development headers.')
145-
146- if not conf.CheckLib(['libvorbis', 'vorbis']):
147- raise Exception('Did not find libvorbis.a, libvorbis.lib, or the libvorbisfile development headers.')
148-
149- if not conf.CheckLib(['libogg', 'ogg']):
150- raise Exception('Did not find libogg.a, libogg.lib, or the libogg development headers, exiting!')
151+ 'or the libvorbisfile development headers.')
152+
153+ libs = ['libvorbis', 'vorbis']
154+ if build.platform_is_windows:
155+ if build.msvcdebug:
156+ libs = ['libvorbis_static-debug','vorbis_static-debug','libvorbis-debug','vorbis-debug']
157+ else:
158+ libs = ['libvorbis', 'vorbis', 'libvorbis_static', 'vorbis_static']
159+ if not conf.CheckLib(libs):
160+ raise Exception('Did not find libvorbis.a, libvorbis.lib, or the libvorbis development headers.')
161+
162+ libs = ['libogg', 'ogg']
163+ if build.platform_is_windows:
164+ if build.msvcdebug:
165+ libs = ['libogg_static-debug','ogg_static-debug','ogg-debug','libogg-debug']
166+ else:
167+ libs = ['libogg', 'ogg', 'libogg_static', 'ogg_static']
168+ if not conf.CheckLib(libs):
169+ raise Exception('Did not find libogg.a, libogg.lib, or the libogg development headers')
170
171 def sources(self, build):
172 return ['soundsourceoggvorbis.cpp']
173@@ -78,9 +120,10 @@
174 class SndFile(Dependence):
175
176 def configure(self, build, conf):
177- #if not conf.CheckLibWithHeader(['sndfile', 'libsndfile'], 'sndfile.h', 'C'):
178- if not conf.CheckLib(['sndfile', 'libsndfile']):
179- raise Exception("Did not find libsndfile or it\'s development headers, exiting!")
180+ #if not conf.CheckLibWithHeader(['sndfile', 'libsndfile', 'libsndfile-1'], 'sndfile.h', 'C'):
181+ # TODO: check for debug version on Windows when one is available
182+ if not conf.CheckLib(['sndfile', 'libsndfile', 'libsndfile-1']):
183+ raise Exception("Did not find libsndfile or it\'s development headers")
184 build.env.Append(CPPDEFINES = '__SNDFILE__')
185
186 def sources(self, build):
187@@ -89,10 +132,18 @@
188 class FLAC(Dependence):
189 def configure(self, build, conf):
190 if not conf.CheckHeader('FLAC/stream_decoder.h'):
191- raise Exception('Did not find libFLAC development headers, exiting!')
192- elif not conf.CheckLib(['libFLAC', 'FLAC']):
193- raise Exception('Did not find libFLAC development libraries, exiting!')
194- return
195+ raise Exception('Did not find libFLAC development headers')
196+ libs = ['libFLAC', 'FLAC']
197+ if build.platform_is_windows:
198+ if build.msvcdebug:
199+ libs = ['libFLAC-debug', 'FLAC-debug', 'libFLAC_static-debug', 'FLAC_static-debug']
200+ else:
201+ libs = ['libFLAC', 'FLAC', 'libFLAC_static', 'FLAC_static']
202+ if not conf.CheckLib(libs):
203+ raise Exception('Did not find libFLAC development libraries')
204+
205+ if build.platform_is_windows and build.static_dependencies:
206+ build.env.Append(CPPDEFINES = 'FLAC__NO_DLL')
207
208 def sources(self, build):
209 return ['soundsourceflac.cpp',]
210@@ -103,6 +154,14 @@
211 'osx': '/Library/Frameworks',
212 'windows': 'C:\\qt\\4.6.0'}
213
214+ @staticmethod
215+ def find_framework_path(qtdir):
216+ for d in (os.path.join(qtdir, x) for x in ['', 'Frameworks', 'lib']):
217+ core = os.path.join(d,'QtCore.framework')
218+ if os.path.isdir(core):
219+ return d
220+ return None
221+
222 def satisfy(self):
223 pass
224
225@@ -111,78 +170,118 @@
226 build.env.Append(CPPDEFINES = ['QT_SHARED',
227 'QT_TABLET_SUPPORT'])
228
229+ # TODO(XXX) what is with the slightly differing modules used for each
230+ # platform here? Document the differences and make them all
231+ # programmatically driven from one list instead of hard-coded multiple
232+ # times.
233+
234+ qt_modules = [
235+ 'QtCore', 'QtGui', 'QtOpenGL', 'QtXml', 'QtSvg',
236+ 'QtSql', 'QtScript', 'QtXmlPatterns', 'QtWebKit',
237+ 'QtNetwork'
238+ #'QtUiTools', #'QtDesigner',
239+ ]
240+
241 # Enable Qt include paths
242 if build.platform_is_linux:
243 if not conf.CheckForPKG('QtCore', '4.6'):
244 raise Exception('QT >= 4.6 not found')
245
246- #Try using David's qt4.py's Qt4-module finding thingy instead of pkg-config.
247 #(This hopefully respects our qtdir=blah flag while linking now.)
248- build.env.EnableQt4Modules(['QtCore',
249- 'QtGui',
250- 'QtOpenGL',
251- 'QtXml',
252- 'QtSvg',
253- 'QtSql',
254- 'QtScript',
255- 'QtXmlPatterns',
256- 'QtWebKit'
257- #'QtUiTools',
258- #'QtDesigner',
259- ],
260- debug=False)
261+ build.env.EnableQt4Modules(qt_modules,debug=False)
262+
263 elif build.platform_is_osx:
264- build.env.Append(LINKFLAGS = '-framework QtCore -framework QtOpenGL -framework QtGui -framework QtSql -framework QtXml -framework QtXmlPatterns -framework QtNetwork -framework QtSql -framework QtScript -framework QtWebKit')
265- build.env.Append(CPPPATH = ['/Library/Frameworks/QtCore.framework/Headers/',
266- '/Library/Frameworks/QtOpenGL.framework/Headers/',
267- '/Library/Frameworks/QtGui.framework/Headers/',
268- '/Library/Frameworks/QtXml.framework/Headers/',
269- '/Library/Frameworks/QtNetwork.framework/Headers/',
270- '/Library/Frameworks/QtSql.framework/Headers/',
271- '/Library/Frameworks/QtWebKit.framework/Headers/',
272- '/Library/Frameworks/QtScript.framework/Headers/'])
273+ qtdir = build.env['QTDIR']
274+ build.env.Append(
275+ LINKFLAGS=' '.join('-framework %s' % m for m in qt_modules)
276+ )
277+ framework_path = Qt.find_framework_path(qtdir)
278+ if not framework_path:
279+ raise Exception('Could not find frameworks in Qt directory: %s' % qtdir)
280+ # Necessary for raw includes of headers like #include <qobject.h>
281+ build.env.Append(CPPPATH = [os.path.join(framework_path, '%s.framework' % m, 'Headers')
282+ for m in qt_modules])
283+ # Framework path needs to be altered for CCFLAGS as well since a
284+ # header include of QtCore/QObject.h looks for a QtCore.framework on
285+ # the search path and a QObject.h in QtCore.framework/Headers.
286+ build.env.Append(CCFLAGS = ['-F%s' % os.path.join(framework_path)])
287+ build.env.Append(LINKFLAGS = ['-F%s' % os.path.join(framework_path)])
288
289 # Setup Qt library includes for non-OSX
290 if build.platform_is_linux or build.platform_is_bsd:
291- build.env.Append(LIBS = 'QtXml')
292+ build.env.Append(LIBS = 'QtCore')
293 build.env.Append(LIBS = 'QtGui')
294- build.env.Append(LIBS = 'QtCore')
295- build.env.Append(LIBS = 'QtNetwork')
296 build.env.Append(LIBS = 'QtOpenGL')
297+ build.env.Append(LIBS = 'QtXml')
298 build.env.Append(LIBS = 'QtWebKit')
299+ build.env.Append(LIBS = 'QtNetwork')
300+
301 build.env.Append(LIBS = 'QtScript')
302 elif build.platform_is_windows:
303 build.env.Append(LIBPATH=['$QTDIR/lib'])
304- build.env.Append(LIBS = 'QtXml4')
305- build.env.Append(LIBS = 'QtXmlPatterns4')
306- build.env.Append(LIBS = 'QtSql4')
307- build.env.Append(LIBS = 'QtGui4')
308- build.env.Append(LIBS = 'QtCore4')
309- build.env.Append(LIBS = 'QtScript4')
310- build.env.Append(LIBS = 'QtWebKit4')
311- build.env.Append(LIBS = 'QtNetwork4')
312- build.env.Append(LIBS = 'QtOpenGL4')
313+ # Since we use WebKit, that's only available dynamically
314+ qt_libs = ['QtCore4',
315+ 'QtGui4',
316+ 'QtOpenGL4',
317+ 'QtXml4',
318+ 'QtWebKit4',
319+ 'QtNetwork4',
320+ 'QtXmlPatterns4',
321+ 'QtSql4',
322+ 'QtScript4',]
323+
324+ # Use the debug versions of the libs if we are building in debug mode.
325+ if build.msvcdebug:
326+ qt_libs = [lib.replace('4', 'd4') for lib in qt_libs]
327+ build.env.Append(LIBS=qt_libs)
328+
329+ # if build.static_dependencies:
330+ # # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf
331+ # # QtCore
332+ # build.env.Append(LIBS = 'kernel32')
333+ # build.env.Append(LIBS = 'user32') # QtGui, QtOpenGL, libHSS1394
334+ # build.env.Append(LIBS = 'shell32')
335+ # build.env.Append(LIBS = 'uuid')
336+ # build.env.Append(LIBS = 'ole32') # QtGui,
337+ # build.env.Append(LIBS = 'advapi32') # QtGui, portaudio, portmidi
338+ # build.env.Append(LIBS = 'ws2_32') # QtGui, QtNetwork, libshout
339+ # # QtGui
340+ # build.env.Append(LIBS = 'gdi32') #QtOpenGL
341+ # build.env.Append(LIBS = 'comdlg32')
342+ # build.env.Append(LIBS = 'oleaut32')
343+ # build.env.Append(LIBS = 'imm32')
344+ # build.env.Append(LIBS = 'winmm')
345+ # build.env.Append(LIBS = 'winspool')
346+ # # QtOpenGL
347+ # build.env.Append(LIBS = 'glu32')
348+ # build.env.Append(LIBS = 'opengl32')
349
350 # Set Qt include paths for non-OSX
351 if not build.platform_is_osx:
352 build.env.Append(CPPPATH=['$QTDIR/include/QtCore',
353 '$QTDIR/include/QtGui',
354+ '$QTDIR/include/QtOpenGL',
355 '$QTDIR/include/QtXml',
356+ '$QTDIR/include/QtWebKit',
357 '$QTDIR/include/QtNetwork',
358+ '$QTDIR/include/QtSql',
359 '$QTDIR/include/QtScript',
360- '$QTDIR/include/QtSql',
361- '$QTDIR/include/QtOpenGL',
362- '$QTDIR/include/QtWebKit',
363 '$QTDIR/include/Qt'])
364
365 # Set the rpath for linux/bsd/osx.
366- # This is not support on OS X before the 10.5 SDK.
367+ # This is not supported on OS X before the 10.5 SDK.
368 using_104_sdk = (str(build.env["CCFLAGS"]).find("10.4") >= 0)
369 compiling_on_104 = False
370 if build.platform_is_osx:
371 compiling_on_104 = (os.popen('sw_vers').readlines()[1].find('10.4') >= 0)
372 if not build.platform_is_windows and not (using_104_sdk or compiling_on_104):
373- build.env.Append(LINKFLAGS = "-Wl,-rpath,$QTDIR/lib")
374+ qtdir = build.env['QTDIR']
375+ # TODO(XXX) should we use find_framework_path here or keep lib
376+ # hardcoded?
377+ framework_path = os.path.join(qtdir, 'lib')
378+ if os.path.isdir(framework_path):
379+ build.env.Append(LINKFLAGS = "-Wl,-rpath," + framework_path)
380+ build.env.Append(LINKFLAGS = "-L," + framework_path)
381
382 #QtSQLite DLL
383 if build.platform_is_windows:
384@@ -214,7 +313,7 @@
385 class ReplayGain(Dependence):
386
387 def sources(self, build):
388- return ["#lib/replaygain/replaygain_analysis.c"]
389+ return ["#lib/replaygain/replaygain.cpp"]
390
391 def configure(self, build, conf):
392 build.env.Append(CPPPATH="#lib/replaygain")
393@@ -268,7 +367,10 @@
394
395 class TagLib(Dependence):
396 def configure(self, build, conf):
397- if not conf.CheckLib('tag'):
398+ libs = ['tag']
399+ if build.msvcdebug:
400+ libs = ['tag-debug']
401+ if not conf.CheckLib(libs):
402 raise Exception("Could not find libtag or its development headers.")
403
404 # Karmic seems to have an issue with mp4tag.h where they don't include
405@@ -277,9 +379,15 @@
406 # deprecate Karmic support. rryan 2/2011
407 build.env.Append(CPPPATH='/usr/include/taglib/')
408
409+ if build.platform_is_windows and build.static_dependencies:
410+ build.env.Append(CPPDEFINES = 'TAGLIB_STATIC')
411+
412 class ProtoBuf(Dependence):
413 def configure(self, build, conf):
414- if not conf.CheckLib(['libprotobuf-lite', 'protobuf-lite', 'libprotobuf', 'protobuf']):
415+ libs = ['libprotobuf-lite', 'protobuf-lite', 'libprotobuf', 'protobuf']
416+ if build.msvcdebug:
417+ libs = ['libprotobuf-lite-debug','protobuf-lite-debug','libprotobuf-debug','protobuf-debug']
418+ if not conf.CheckLib(libs):
419 raise Exception("Could not find libprotobuf or its development headers.")
420
421 class MixxxCore(Feature):
422@@ -374,6 +482,7 @@
423 "controllers/controllerlearningeventfilter.cpp",
424 "controllers/controllermanager.cpp",
425 "controllers/controllerpresetfilehandler.cpp",
426+ "controllers/controllerpresetinfo.cpp",
427 "controllers/midi/midicontroller.cpp",
428 "controllers/midi/midicontrollerpresetfilehandler.cpp",
429 "controllers/midi/midienumerator.cpp",
430@@ -433,6 +542,7 @@
431 "library/searchqueryparser.cpp",
432 "library/preparelibrarytablemodel.cpp",
433 "library/missingtablemodel.cpp",
434+ "library/hiddentablemodel.cpp",
435 "library/proxytrackmodel.cpp",
436
437 "library/playlisttablemodel.cpp",
438@@ -521,20 +631,30 @@
439 "waveform/renderers/waveformrenderbeat.cpp",
440 "waveform/renderers/waveformrendererendoftrack.cpp",
441 "waveform/renderers/waveformrendererpreroll.cpp",
442+
443 "waveform/renderers/waveformrendererfilteredsignal.cpp",
444+ "waveform/renderers/qtwaveformrendererfilteredsignal.cpp",
445+ "waveform/renderers/qtwaveformrenderersimplesignal.cpp",
446 "waveform/renderers/glwaveformrendererfilteredsignal.cpp",
447+ "waveform/renderers/glwaveformrenderersimplesignal.cpp",
448 "waveform/renderers/glslwaveformrenderersignal.cpp",
449+
450 "waveform/renderers/waveformsignalcolors.cpp",
451- "waveform/renderers/glwaveformrenderersimplesignal.cpp",
452+
453+ "waveform/renderers/waveformrenderersignalbase.cpp",
454 "waveform/renderers/waveformmark.cpp",
455+ "waveform/renderers/waveformmarkset.cpp",
456 "waveform/renderers/waveformmarkrange.cpp",
457
458 "waveform/widgets/waveformwidgetabstract.cpp",
459- "waveform/widgets/glwaveformwidget.cpp",
460 "waveform/widgets/emptywaveformwidget.cpp",
461 "waveform/widgets/softwarewaveformwidget.cpp",
462+ "waveform/widgets/qtwaveformwidget.cpp",
463+ "waveform/widgets/qtsimplewaveformwidget.cpp",
464+ "waveform/widgets/glwaveformwidget.cpp",
465+ "waveform/widgets/glsimplewaveformwidget.cpp",
466+
467 "waveform/widgets/glslwaveformwidget.cpp",
468- "waveform/widgets/glsimplewaveformwidget.cpp",
469
470 "skin/imginvert.cpp",
471 "skin/imgloader.cpp",
472@@ -572,6 +692,7 @@
473 "tapfilter.cpp",
474
475 "util/pa_ringbuffer.c",
476+ "util/sleepableqthread.cpp",
477
478 # Add the QRC file which compiles in some extra resources
479 # (prefs icons, etc.)
480@@ -696,16 +817,19 @@
481
482 elif build.platform_is_osx:
483 #Stuff you may have compiled by hand
484- build.env.Append(LIBPATH = ['/usr/local/lib'])
485- build.env.Append(CPPPATH = ['/usr/local/include'])
486+ if os.path.isdir('/usr/local/include'):
487+ build.env.Append(LIBPATH = ['/usr/local/lib'])
488+ build.env.Append(CPPPATH = ['/usr/local/include'])
489
490 #Non-standard libpaths for fink and certain (most?) darwin ports
491- build.env.Append(LIBPATH = ['/sw/lib'])
492- build.env.Append(CPPPATH = ['/sw/include'])
493+ if os.path.isdir('/sw/include'):
494+ build.env.Append(LIBPATH = ['/sw/lib'])
495+ build.env.Append(CPPPATH = ['/sw/include'])
496
497 #Non-standard libpaths for darwin ports
498- build.env.Append(LIBPATH = ['/opt/local/lib'])
499- build.env.Append(CPPPATH = ['/opt/local/include'])
500+ if os.path.isdir('/opt/local/include'):
501+ build.env.Append(LIBPATH = ['/opt/local/lib'])
502+ build.env.Append(CPPPATH = ['/opt/local/include'])
503
504 elif build.platform_is_bsd:
505 build.env.Append(CPPDEFINES='__BSD__')
506@@ -770,9 +894,11 @@
507 after the Configure checks run."""
508 if build.platform_is_windows:
509 if build.toolchain_is_msvs:
510- build.env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT.lib',
511- '/nodefaultlib:LIBCMTd.lib',
512- '/entry:mainCRTStartup'])
513+ if not build.static_dependencies or build.msvcdebug:
514+ build.env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT.lib',
515+ '/nodefaultlib:LIBCMTd.lib'])
516+
517+ build.env.Append(LINKFLAGS = '/entry:mainCRTStartup')
518 # Makes the program not launch a shell first
519 build.env.Append(LINKFLAGS = '/subsystem:windows')
520 build.env.Append(LINKFLAGS = '/manifest') #Force MSVS to generate a manifest (MSVC2010)
521
522=== modified file 'mixxx/build/features.py'
523--- mixxx/build/features.py 2012-04-30 14:53:46 +0000
524+++ mixxx/build/features.py 2012-10-25 21:24:26 +0000
525@@ -35,20 +35,28 @@
526 # raise Exception('Could not find libffado.')
527 else:
528 # if not conf.CheckHeader('HSS1394/HSS1394.h'): # WTF this gives tons of cmath errors on MSVC
529-# raise Exception('Did not find HSS1394 development headers, exiting!')
530+# raise Exception('Did not find HSS1394 development headers')
531 # elif not conf.CheckLib(['libHSS1394', 'HSS1394']):
532- if not conf.CheckLib(['libhss1394', 'hss1394']):
533- raise Exception('Did not find HSS1394 development library, exiting!')
534- return
535+ libs = ['libhss1394', 'hss1394']
536+ if build.platform_is_windows:
537+ if build.msvcdebug:
538+ libs = ['libhss1394-debug', 'hss1394-debug', 'libHSS1394_x64_Debug', 'libHSS1394_x86_Debug']
539+ else:
540+ libs = ['libhss1394', 'hss1394', 'libHSS1394_x64_Release', 'libHSS1394_x86_Release']
541+ if not conf.CheckLib(libs):
542+ raise Exception('Did not find HSS1394 development library')
543
544 build.env.Append(CPPDEFINES = '__HSS1394__')
545
546+ if build.platform_is_windows and build.static_dependencies:
547+ conf.CheckLib('user32')
548+
549 def sources(self, build):
550 return ['controllers/midi/hss1394controller.cpp',
551 'controllers/midi/hss1394enumerator.cpp']
552
553 class HID(Feature):
554- HIDAPI_INTERNAL_PATH = '#lib/hidapi-0.7.0'
555+ HIDAPI_INTERNAL_PATH = '#lib/hidapi-0.8.0-pre'
556 def description(self):
557 return "HID controller support"
558
559@@ -72,7 +80,7 @@
560 build.env.ParseConfig('pkg-config libusb-1.0 --silence-errors --cflags --libs')
561 if (not conf.CheckLib(['libusb-1.0', 'usb-1.0']) or
562 not conf.CheckHeader('libusb-1.0/libusb.h')):
563- raise Exception('Did not find the libusb 1.0 development library or its header file, exiting!')
564+ raise Exception('Did not find the libusb 1.0 development library or its header file')
565
566 # Optionally add libpthread and librt. Some distros need this.
567 conf.CheckLib(['pthread', 'libpthread'])
568@@ -94,14 +102,48 @@
569 if build.platform_is_windows:
570 # Requires setupapi.lib which is included by the above check for
571 # setupapi.
572- sources.append("#lib/hidapi-0.7.0/windows/hid.c")
573- return sources
574+ sources.append(os.path.join(self.HIDAPI_INTERNAL_PATH, "windows/hid.c"))
575 elif build.platform_is_linux:
576 sources.append(os.path.join(self.HIDAPI_INTERNAL_PATH, 'linux/hid-libusb.c'))
577 elif build.platform_is_osx:
578 sources.append(os.path.join(self.HIDAPI_INTERNAL_PATH, 'mac/hid.c'))
579 return sources
580
581+class Bulk(Feature):
582+ def description(self):
583+ return "USB Bulk controller support"
584+
585+ def enabled(self, build):
586+ # For now only make Bulk default on Linux only. Turn on for all
587+ # platforms after the 1.11.0 release.
588+ is_default = 1 if build.platform_is_linux else 0
589+ build.flags['bulk'] = util.get_flags(build.env, 'bulk', is_default)
590+ if int(build.flags['bulk']):
591+ return True
592+ return False
593+
594+ def add_options(self, build, vars):
595+ is_default = 1 if build.platform_is_linux else 0
596+ vars.Add('bulk', 'Set to 1 to enable USB Bulk controller support.', is_default)
597+
598+ def configure(self, build, conf):
599+ if not self.enabled(build):
600+ return
601+
602+ build.env.ParseConfig('pkg-config libusb-1.0 --silence-errors --cflags --libs')
603+ if (not conf.CheckLib(['libusb-1.0', 'usb-1.0']) or
604+ not conf.CheckHeader('libusb-1.0/libusb.h')):
605+ raise Exception('Did not find the libusb 1.0 development library or its header file, exiting!')
606+
607+ build.env.Append(CPPDEFINES = '__BULK__')
608+
609+ def sources(self, build):
610+ sources = ['controllers/bulk/bulkcontroller.cpp',
611+ 'controllers/bulk/bulkenumerator.cpp']
612+
613+ return sources
614+
615+
616 class Mad(Feature):
617 def description(self):
618 return "MAD MP3 Decoder"
619@@ -270,6 +312,8 @@
620 return ['wipodtracksmodel.cpp']
621
622 class MSVCDebug(Feature):
623+ # FIXME: this flag is also detected in mixxx.py at line 100 because it's needed sooner than this is processed
624+ # I don't know the best way to fix this and still have it show up with scons -h. - Sean, Aug 2012
625 def description(self):
626 return "MSVC Debugging"
627
628@@ -288,9 +332,12 @@
629 if not build.toolchain_is_msvs:
630 raise Exception("Error, msvcdebug flag set when toolchain is not MSVS.")
631
632- # Enable debug multithread and DLL specific runtime methods. Required
633- # for sndfile w/ flac support on windows.
634+ #if build.static_dependencies:
635+ # build.env.Append(CCFLAGS = '/MTd')
636+ #else:
637+ # build.env.Append(CCFLAGS = '/MDd')
638 build.env.Append(CCFLAGS = '/MDd')
639+
640 build.env.Append(LINKFLAGS = '/DEBUG')
641 build.env.Append(CPPDEFINES = 'DEBUGCONSOLE')
642 if build.machine_is_64bit:
643@@ -299,11 +346,12 @@
644 else:
645 build.env.Append(CCFLAGS = '/ZI')
646 elif build.toolchain_is_msvs:
647- # Enable multithreaded and DLL specific runtime methods. Required
648- # for sndfile w/ flac support on windows
649+ #if build.static_dependencies:
650+ # build.env.Append(CCFLAGS = '/MT')
651+ #else:
652+ # build.env.Append(CCFLAGS = '/MD')
653 build.env.Append(CCFLAGS = '/MD')
654
655-
656 class HifiEq(Feature):
657 def description(self):
658 return "High quality EQs"
659@@ -429,7 +477,6 @@
660 sources = ['vamp/vampanalyser.cpp',
661 'vamp/vamppluginloader.cpp',
662 'analyserbeats.cpp',
663- 'analysergainvamp.cpp',
664 'dlgprefbeats.cpp']
665 if self.INTERNAL_LINK:
666 hostsdk_src_path = '%s/src/vamp-hostsdk' % self.INTERNAL_VAMP_PATH
667@@ -527,6 +574,8 @@
668 return "Agner Fog\'s ASMLIB"
669
670 def enabled(self, build):
671+ if build.msvcdebug:
672+ return False
673 build.flags['asmlib'] = util.get_flags(build.env, 'asmlib', 0)
674 if int(build.flags['asmlib']):
675 return True
676@@ -536,19 +585,22 @@
677 vars.Add('asmlib','Set to 1 to enable linking against Agner Fog\'s hand-optimized asmlib, found at http://www.agner.org/optimize/', 0)
678
679 def configure(self, build, conf):
680+ if build.msvcdebug:
681+ self.status = "Disabled (due to MSVC debug mode)"
682+ return
683 if not self.enabled(build):
684 return
685
686 build.env.Append(LIBPATH='#/../asmlib')
687 if build.platform_is_linux:
688 build.env.Append(CCFLAGS = '-fno-builtin') #Use ASMLIB's functions instead of the compiler's
689- build.env.Append(LIBS = '":alibelf%so.a"' % build.bitwidth)
690+ build.env.Prepend(LIBS = '":alibelf%so.a"' % build.bitwidth)
691 elif build.platform_is_osx:
692 build.env.Append(CCFLAGS = '-fno-builtin') #Use ASMLIB's functions instead of the compiler's
693- build.env.Append(LIBS = '":alibmac%so.a"' % build.bitwidth)
694+ build.env.Prepend(LIBS = '":alibmac%so.a"' % build.bitwidth)
695 elif build.platform_is_windows:
696 build.env.Append(CCFLAGS = '/Oi-') #Use ASMLIB's functions instead of the compiler's
697- build.env.Append(LIBS = 'alibcof%so' % build.bitwidth)
698+ build.env.Prepend(LIBS = 'alibcof%so' % build.bitwidth)
699
700
701 class QDebug(Feature):
702@@ -721,7 +773,7 @@
703 if not libshout_found:
704 raise Exception('Could not find libshout or its development headers. Please install it or compile Mixxx without Shoutcast support using the shoutcast=0 flag.')
705
706- # libvorbisenc does only exist on Linux, OSX and mingw32 on Windows. On
707+ # libvorbisenc only exists on Linux, OSX and mingw32 on Windows. On
708 # Windows with MSVS it is included in vorbisfile.dll. libvorbis and
709 # libogg are included from build.py so don't add here.
710 if not build.platform_is_windows or build.toolchain_is_gnu:
711@@ -729,6 +781,10 @@
712 if not vorbisenc_found:
713 raise Exception("libvorbisenc was not found! Please install it or compile Mixxx without Shoutcast support using the shoutcast=0 flag.")
714
715+ if build.platform_is_windows and build.static_dependencies:
716+ conf.CheckLib('winmm')
717+ conf.CheckLib('ws2_32')
718+
719 def sources(self, build):
720 build.env.Uic4('dlgprefshoutcastdlg.ui')
721 return ['dlgprefshoutcast.cpp',
722
723=== modified file 'mixxx/build/mixxx.py'
724--- mixxx/build/mixxx.py 2012-04-15 22:18:28 +0000
725+++ mixxx/build/mixxx.py 2012-10-25 21:24:26 +0000
726@@ -96,11 +96,18 @@
727
728 self.build_dir = util.get_build_dir(self.platform, self.bitwidth)
729
730+ # Currently this only works for Windows
731+ self.static_dependencies = int(Script.ARGUMENTS.get('staticlibs', 0))
732+ self.msvcdebug = int(Script.ARGUMENTS.get('msvcdebug', 0))
733+
734 logging.info("Target Platform: %s" % self.platform)
735 logging.info("Target Machine: %s" % self.machine)
736 logging.info("Build: %s" % self.build)
737 logging.info("Toolchain: %s" % self.toolchain)
738 logging.info("Crosscompile: %s" % ("YES" if self.crosscompile else "NO"))
739+ if self.platform_is_windows:
740+ logging.info("Static dependencies: %s" % ("YES" if self.static_dependencies else "NO"))
741+ logging.info("MSVC Debug build: %s" % ("YES" if self.msvcdebug else "NO"))
742
743 if self.crosscompile:
744 logging.info("Host Platform: %s" % self.host_platform)
745
746=== modified file 'mixxx/build/nsis/Mixxx.nsi'
747--- mixxx/build/nsis/Mixxx.nsi 2012-04-29 21:04:11 +0000
748+++ mixxx/build/nsis/Mixxx.nsi 2012-10-25 21:24:26 +0000
749@@ -123,12 +123,15 @@
750 ; Put the VC redist installer files there
751 File ${WINLIB_PATH}\VC_redist\vc_red.cab
752 File ${WINLIB_PATH}\VC_redist\vc_red.msi
753+ File ${WINLIB_PATH}\VC_redist\msp_kb2565063.msp
754
755 ClearErrors
756 ; Call it & wait for it to install
757 ExecWait 'msiexec /i $TEMP\vc_red.msi'
758+ ExecWait 'msiexec /update $TEMP\msp_kb2565063.msp'
759 Delete "$TEMP\vc_red.cab"
760 Delete "$TEMP\vc_red.msi"
761+ Delete "$TEMP\msp_kb2565063.msp"
762 IfErrors 0 VCRedistDone
763 MessageBox MB_ICONSTOP|MB_OK "There was a problem installing the Microsoft Visual C++ libraries.$\r$\nYou may need to run this installer as an administrator."
764 Abort
765@@ -225,7 +228,7 @@
766 File /nonfatal /r "${BASE_BUILD_DIR}\dist${BITWIDTH}\plugins\vamp\*.dll"
767
768 SetOutPath $INSTDIR\keyboard
769- File "${BASE_BUILD_DIR}\dist${BITWIDTH}\keyboard\Standard.kbd.cfg"
770+ File "${BASE_BUILD_DIR}\dist${BITWIDTH}\keyboard\*.kbd.cfg"
771
772 ; HID/MIDI mapping tools (mappings are below) & common script file
773 SetOutPath $INSTDIR\controllers
774@@ -403,7 +406,6 @@
775 SetOutPath $INSTDIR
776 CreateShortCut "$SMPROGRAMS\Mixxx\Mixxx.lnk" "$INSTDIR\mixxx.exe" "" "$INSTDIR\mixxx.exe" 0
777 CreateShortCut "$SMPROGRAMS\Mixxx\Manual.lnk" "$INSTDIR\Mixxx-Manual.pdf" "" "$INSTDIR\Mixxx-Manual.pdf" 0
778- CreateShortCut "$SMPROGRAMS\Mixxx\Uninstall.lnk" "$INSTDIR\UninstallMixxx.exe" "" "$INSTDIR\UninstallMixxx.exe" 0
779
780 SectionEnd
781
782@@ -510,8 +512,9 @@
783 RMDir "$INSTDIR\translations"
784
785 ; Remove keyboard mappings
786- Delete $INSTDIR\keyboard\Standard.kbd.cfg
787- Delete $INSTDIR\keyboard\Old-pre1.10.0.kbd.cfg
788+ ; TODO(XXX): Only delete files that were not changed since install
789+ ; Custom Keyboard mappings should be placed in Custom.kbd.cfg in user folder
790+ Delete $INSTDIR\keyboard\*.kbd.cfg
791 RMDir "$INSTDIR\keyboard" ; No /r flag means remove the directory only if it's empty
792
793 ; Remove midi mappings/scripts that we may have installed
794@@ -525,7 +528,6 @@
795 Delete "$INSTDIR\controllers\American-Audio-VMS4-scripts.js"
796 Delete "$INSTDIR\controllers\Behringer BCD3000.midi.xml"
797 Delete "$INSTDIR\controllers\Behringer-BCD3000-scripts.js"
798- Delete "$INSTDIR\controllers\BindableConfigKeys.txt"
799 Delete "$INSTDIR\controllers\convertToXMLSchemaV1.php"
800 Delete "$INSTDIR\controllers\DJ-Tech i-Mix Reload.midi.xml"
801 Delete "$INSTDIR\controllers\DJ-Tech-i-Mix-Reload-scripts.js"
802@@ -533,7 +535,6 @@
803 Delete "$INSTDIR\controllers\DJTechTools-MIDIFighter-scripts.js"
804 Delete "$INSTDIR\controllers\Evolution_Xsession.midi.xml"
805 Delete "$INSTDIR\controllers\FaderFoxDJ2.midi.xml"
806- Delete "$INSTDIR\controllers\format.txt"
807 Delete "$INSTDIR\controllers\Hercules DJ Console Mac Edition.midi.xml"
808 Delete "$INSTDIR\controllers\Hercules DJ Console Mk2.midi.xml"
809 Delete "$INSTDIR\controllers\Hercules-DJ-Console-Mk2-scripts.js"
810@@ -574,6 +575,7 @@
811 Delete "$INSTDIR\controllers\Pioneer-CDJ-350-scripts.js"
812 Delete "$INSTDIR\controllers\Pioneer CDJ-850.midi.xml"
813 Delete "$INSTDIR\controllers\Pioneer-CDJ-850-scripts.js"
814+ Delete "$INSTDIR\controllers\README.txt"
815 Delete "$INSTDIR\controllers\Reloop Digital Jockey 2 Controller Edition.midi.xml"
816 Delete "$INSTDIR\controllers\Reloop-Digital-Jockey2-Controller-scripts.js"
817 Delete "$INSTDIR\controllers\Stanton SCS.1d.midi.xml"
818
819=== modified file 'mixxx/build/osx/OSConsX.py'
820--- mixxx/build/osx/OSConsX.py 2011-12-23 23:36:00 +0000
821+++ mixxx/build/osx/OSConsX.py 2012-10-25 21:24:26 +0000
822@@ -18,7 +18,7 @@
823
824
825
826-import sys, os, shutil
827+import sys, os, shutil, stat
828 import SCons
829 from SCons.Builder import Builder
830 from SCons.Script import *
831@@ -280,6 +280,10 @@
832 print "Installing embedded libs:"
833 for ref, (abs, embedded) in locals.iteritems():
834 Execute(Copy(embedded, abs))
835+ if not os.access(embedded, os.W_OK):
836+ print "Adding write permissions to %s" % embedded_p
837+ mode = os.stat(embedded).st_mode
838+ os.chmod(embedded, mode | stat.S_IWUSR)
839 patch_lib(embedded)
840
841
842@@ -352,6 +356,7 @@
843 human_readable_copyright = env['COPYRIGHT']
844 application_category_type = env['CATEGORY']
845
846+
847 #BUG: if the icon file is changed but nothing else then the plist doesn't get rebuilt (but since it's a str() and not a Node() there's no clean way to hook this in)
848
849 #Precache some the important paths
850@@ -375,16 +380,19 @@
851 env.Writer(File(os.path.join(str(contents),"PkgInfo")), [], DATA = "%s%s" % (bundle_type, bundle_signature))
852
853 #.title() in the next line is used to make sure the titlebar on OS X has the capitalized name of the app
854- env.Plist(os.path.join(str(contents), "Info"),
855- PLIST={'CFBundleExecutable': binary.name.title(),
856- 'CFBundleIconFile': icon,
857- 'CFBundlePackageType': bundle_type,
858- 'CFBundleSignature': bundle_signature,
859- 'CFBundleIdentifier': bundle_identifier,
860- 'CFBundleDisplayName': bundle_display_name,
861- 'CFBundleShortVersionString' : bundle_short_version_string,
862- 'NSHumanReadableCopyright' : human_readable_copyright,
863- 'LSApplicationCategoryType' : application_category_type})
864+ plist_data = {'CFBundleExecutable': binary.name.title(),
865+ 'CFBundleIconFile': icon,
866+ 'CFBundlePackageType': bundle_type,
867+ 'CFBundleSignature': bundle_signature,
868+ 'CFBundleIdentifier': bundle_identifier,
869+ 'CFBundleDisplayName': bundle_display_name,
870+ 'CFBundleShortVersionString' : bundle_short_version_string,
871+ 'NSHumanReadableCopyright' : human_readable_copyright,
872+ 'LSApplicationCategoryType' : application_category_type}
873+ if env['FOR_APP_STORE']:
874+ plist_data['ForAppStore'] = 'yes'
875+ env.Plist(os.path.join(str(contents), "Info"), PLIST=plist_data)
876+
877 #NB: only need CFBundleExecutale if the binary name differs from the bundle name
878 #todo:
879 """Application Keys
880@@ -418,12 +426,37 @@
881
882 return bundle, source+plugins #+[installed_bin]
883
884-
885-
886-
887 App = Builder(action = build_app, emitter = emit_app)
888
889
890+def do_codesign(target, source, env):
891+ # target[0] is a File object, coerce to string to get its path (usually
892+ # something like osxXX_build/Mixxx)
893+ bundle = str(target[0])
894+
895+ # HACK(XXX) SCons can't have a Dir which is a target so we append .app here
896+ # since our actual target (the thing we want to codesign) is the bundle
897+ # folder.
898+ if not bundle.endswith('.app'):
899+ bundle += '.app'
900+
901+ keychain = env.get('CODESIGN_KEYCHAIN', None)
902+ keychain_password = env.get('CODESIGN_KEYCHAIN_PASSWORD', None)
903+ identity = env.get('CODESIGN_IDENTITY', None)
904+ if identity is not None:
905+ if keychain and keychain_password is not None:
906+ print "Unlocking keychain:"
907+ if system("security unlock-keychain -p '%s' %s" % (keychain_password, keychain)) != 0:
908+ raise Exception('Could not unlock keychain.')
909+ print "Codesigning App:"
910+ command = "codesign -f -s '%s'%s %s" % (identity,
911+ ' --keychain %s' % keychain if keychain else '',
912+ bundle)
913+ if system(command) != 0:
914+ raise Exception('codesign failed')
915+
916+CodeSign = Builder(action = do_codesign)
917+
918
919 def build_plist(target, source, env):
920 d = env['PLIST']
921@@ -461,7 +494,8 @@
922 env['BUILDERS']['Dmg'] = Dmg
923 env['BUILDERS']['Plist'] = Plist
924 env['BUILDERS']['Writer'] = Writer #this should be in a different module, really
925- env['BUILDERS']
926+ env['BUILDERS']['CodeSign'] = CodeSign
927+
928
929 def exists(env):
930 return os.platform == 'darwin'
931
932=== modified file 'mixxx/build/osx/otool.py'
933--- mixxx/build/osx/otool.py 2011-12-23 23:00:28 +0000
934+++ mixxx/build/osx/otool.py 2012-10-25 21:24:26 +0000
935@@ -51,8 +51,15 @@
936 SYSTEM_FRAMEWORKS = ["/System/Library/Frameworks"]
937 SYSTEM_LIBPATH = ["/usr/lib"] #anything else?
938 #paths to libs that we should copy in
939-LOCAL_FRAMEWORKS = [os.path.expanduser("~/Library/Frameworks"), "/Library/Frameworks", "/Network/Library/Frameworks"]
940-LOCAL_LIBPATH = ["/usr/local/lib", "/opt/local/lib", "/sw/local/lib"]
941+LOCAL_FRAMEWORKS = [
942+ os.path.expanduser("~/Library/Frameworks"),
943+ "/Library/Frameworks",
944+ "/Network/Library/Frameworks"
945+]
946+LOCAL_LIBPATH = filter(lambda x:
947+ os.path.isdir(x),
948+ ["/usr/local/lib", "/opt/local/lib", "/sw/local/lib"]
949+)
950
951 #however
952 FRAMEWORKS = LOCAL_FRAMEWORKS + SYSTEM_FRAMEWORKS
953
954=== modified file 'mixxx/build/qt4.py'
955--- mixxx/build/qt4.py 2011-10-07 06:02:31 +0000
956+++ mixxx/build/qt4.py 2012-10-25 21:24:26 +0000
957@@ -1,3 +1,4 @@
958+# -*- coding: utf-8 -*-
959
960 """SCons.Tool.qt
961
962
963=== modified file 'mixxx/build/util.py'
964--- mixxx/build/util.py 2012-04-26 21:19:31 +0000
965+++ mixxx/build/util.py 2012-10-25 21:24:26 +0000
966@@ -59,7 +59,7 @@
967 version = ""
968
969 for line in open(str(defs)).readlines():
970- if line.strip().startswith("#define VERSION"):
971+ if line.strip().startswith("#define VERSION "):
972 version = line
973 break
974
975@@ -113,3 +113,16 @@
976 ret = context.TryAction( "pkg-config --atleast-version=%s '%s'" % (version,name) )[0]
977 context.Result( ret )
978 return ret
979+
980+def write_build_header(path):
981+ f = open(path, 'w')
982+ try:
983+ branch_name = get_bzr_branch_name()
984+ modified = get_bzr_modified() > 0
985+ # Do not emit BUILD_BRANCH on release branches.
986+ if not branch_name.startswith('release'):
987+ f.write('#define BUILD_BRANCH "%s"\n' % branch_name)
988+ f.write('#define BUILD_REV "%s%s"\n' % (get_bzr_revision(),
989+ '+' if modified else ''))
990+ finally:
991+ f.close()
992
993=== added directory 'mixxx/doc'
994=== added directory 'mixxx/doc/HID'
995=== added file 'mixxx/doc/HID/HID Packet Parser Documentation.odt'
996Binary files mixxx/doc/HID/HID Packet Parser Documentation.odt 1970-01-01 00:00:00 +0000 and mixxx/doc/HID/HID Packet Parser Documentation.odt 2012-10-25 21:24:26 +0000 differ
997=== added file 'mixxx/doc/HID/HID Packet Parser Documentation.pdf'
998Binary files mixxx/doc/HID/HID Packet Parser Documentation.pdf 1970-01-01 00:00:00 +0000 and mixxx/doc/HID/HID Packet Parser Documentation.pdf 2012-10-25 21:24:26 +0000 differ
999=== removed directory 'mixxx/lib/hidapi-0.7.0'
1000=== removed file 'mixxx/lib/hidapi-0.7.0/LICENSE-orig.txt'
1001--- mixxx/lib/hidapi-0.7.0/LICENSE-orig.txt 2012-01-28 09:23:48 +0000
1002+++ mixxx/lib/hidapi-0.7.0/LICENSE-orig.txt 1970-01-01 00:00:00 +0000
1003@@ -1,9 +0,0 @@
1004- HIDAPI - Multi-Platform library for
1005- communication with HID devices.
1006-
1007- Copyright 2009, Alan Ott, Signal 11 Software.
1008- All Rights Reserved.
1009-
1010- This software may be used by anyone for any reason so
1011- long as the copyright notice in the source files
1012- remains intact.
1013
1014=== removed file 'mixxx/lib/hidapi-0.7.0/LICENSE.txt'
1015--- mixxx/lib/hidapi-0.7.0/LICENSE.txt 2012-01-28 09:23:48 +0000
1016+++ mixxx/lib/hidapi-0.7.0/LICENSE.txt 1970-01-01 00:00:00 +0000
1017@@ -1,13 +0,0 @@
1018-HIDAPI can be used under one of three licenses.
1019-
1020-1. The GNU Public License, version 3.0, in LICENSE-gpl3.txt
1021-2. A BSD-Style License, in LICENSE-bsd.txt.
1022-3. The more liberal original HIDAPI license. LICENSE-orig.txt
1023-
1024-The license chosen is at the discretion of the user of HIDAPI. For example:
1025-1. An author of GPL software would likely use HIDAPI under the terms of the
1026-GPL.
1027-
1028-2. An author of commercial closed-source software would likely use HIDAPI
1029-under the terms of the BSD-style license or the original HIDAPI license.
1030-
1031
1032=== removed directory 'mixxx/lib/hidapi-0.7.0/hidapi'
1033=== removed file 'mixxx/lib/hidapi-0.7.0/hidapi/hidapi.h'
1034--- mixxx/lib/hidapi-0.7.0/hidapi/hidapi.h 2012-01-28 09:23:48 +0000
1035+++ mixxx/lib/hidapi-0.7.0/hidapi/hidapi.h 1970-01-01 00:00:00 +0000
1036@@ -1,383 +0,0 @@
1037-/*******************************************************
1038- HIDAPI - Multi-Platform library for
1039- communication with HID devices.
1040-
1041- Alan Ott
1042- Signal 11 Software
1043-
1044- 8/22/2009
1045-
1046- Copyright 2009, All Rights Reserved.
1047-
1048- At the discretion of the user of this library,
1049- this software may be licensed under the terms of the
1050- GNU Public License v3, a BSD-Style license, or the
1051- original HIDAPI license as outlined in the LICENSE.txt,
1052- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
1053- files located at the root of the source distribution.
1054- These files may also be found in the public source
1055- code repository located at:
1056- http://github.com/signal11/hidapi .
1057-********************************************************/
1058-
1059-/** @file
1060- * @defgroup API hidapi API
1061- */
1062-
1063-#ifndef HIDAPI_H__
1064-#define HIDAPI_H__
1065-
1066-#include <wchar.h>
1067-
1068-#ifdef _WIN32
1069- #define HID_API_EXPORT __declspec(dllexport)
1070- #define HID_API_CALL
1071-#else
1072- #define HID_API_EXPORT /**< API export macro */
1073- #define HID_API_CALL /**< API call macro */
1074-#endif
1075-
1076-#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/
1077-
1078-#ifdef __cplusplus
1079-extern "C" {
1080-#endif
1081- struct hid_device_;
1082- typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
1083-
1084- /** hidapi info structure */
1085- struct hid_device_info {
1086- /** Platform-specific device path */
1087- char *path;
1088- /** Device Vendor ID */
1089- unsigned short vendor_id;
1090- /** Device Product ID */
1091- unsigned short product_id;
1092- /** Serial Number */
1093- wchar_t *serial_number;
1094- /** Device Release Number in binary-coded decimal,
1095- also known as Device Version Number */
1096- unsigned short release_number;
1097- /** Manufacturer String */
1098- wchar_t *manufacturer_string;
1099- /** Product string */
1100- wchar_t *product_string;
1101- /** Usage Page for this Device/Interface
1102- (Windows/Mac only). */
1103- unsigned short usage_page;
1104- /** Usage for this Device/Interface
1105- (Windows/Mac only).*/
1106- unsigned short usage;
1107- /** The USB interface which this logical device
1108- represents. Valid on both Linux implementations
1109- in all cases, and valid on the Windows implementation
1110- only if the device contains more than one interface. */
1111- int interface_number;
1112-
1113- /** Pointer to the next device */
1114- struct hid_device_info *next;
1115- };
1116-
1117-
1118- /** @brief Initialize the HIDAPI library.
1119-
1120- This function initializes the HIDAPI library. Calling it is not
1121- strictly necessary, as it will be called automatically by
1122- hid_enumerate() and any of the hid_open_*() functions if it is
1123- needed. This function should be called at the beginning of
1124- execution however, if there is a chance of HIDAPI handles
1125- being opened by different threads simultaneously.
1126-
1127- @ingroup API
1128-
1129- @returns
1130- This function returns 0 on success and -1 on error.
1131- */
1132- int HID_API_EXPORT HID_API_CALL hid_init(void);
1133-
1134- /** @brief Finalize the HIDAPI library.
1135-
1136- This function frees all of the static data associated with
1137- HIDAPI. It should be called at the end of execution to avoid
1138- memory leaks.
1139-
1140- @ingroup API
1141-
1142- @returns
1143- This function returns 0 on success and -1 on error.
1144- */
1145- int HID_API_EXPORT HID_API_CALL hid_exit(void);
1146-
1147- /** @brief Enumerate the HID Devices.
1148-
1149- This function returns a linked list of all the HID devices
1150- attached to the system which match vendor_id and product_id.
1151- If @p vendor_id and @p product_id are both set to 0, then
1152- all HID devices will be returned.
1153-
1154- @ingroup API
1155- @param vendor_id The Vendor ID (VID) of the types of device
1156- to open.
1157- @param product_id The Product ID (PID) of the types of
1158- device to open.
1159-
1160- @returns
1161- This function returns a pointer to a linked list of type
1162- struct #hid_device, containing information about the HID devices
1163- attached to the system, or NULL in the case of failure. Free
1164- this linked list by calling hid_free_enumeration().
1165- */
1166- struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
1167-
1168- /** @brief Free an enumeration Linked List
1169-
1170- This function frees a linked list created by hid_enumerate().
1171-
1172- @ingroup API
1173- @param devs Pointer to a list of struct_device returned from
1174- hid_enumerate().
1175- */
1176- void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs);
1177-
1178- /** @brief Open a HID device using a Vendor ID (VID), Product ID
1179- (PID) and optionally a serial number.
1180-
1181- If @p serial_number is NULL, the first device with the
1182- specified VID and PID is opened.
1183-
1184- @ingroup API
1185- @param vendor_id The Vendor ID (VID) of the device to open.
1186- @param product_id The Product ID (PID) of the device to open.
1187- @param serial_number The Serial Number of the device to open
1188- (Optionally NULL).
1189-
1190- @returns
1191- This function returns a pointer to a #hid_device object on
1192- success or NULL on failure.
1193- */
1194- HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number);
1195-
1196- /** @brief Open a HID device by its path name.
1197-
1198- The path name be determined by calling hid_enumerate(), or a
1199- platform-specific path name can be used (eg: /dev/hidraw0 on
1200- Linux).
1201-
1202- @ingroup API
1203- @param path The path name of the device to open
1204-
1205- @returns
1206- This function returns a pointer to a #hid_device object on
1207- success or NULL on failure.
1208- */
1209- HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path);
1210-
1211- /** @brief Write an Output report to a HID device.
1212-
1213- The first byte of @p data[] must contain the Report ID. For
1214- devices which only support a single report, this must be set
1215- to 0x0. The remaining bytes contain the report data. Since
1216- the Report ID is mandatory, calls to hid_write() will always
1217- contain one more byte than the report contains. For example,
1218- if a hid report is 16 bytes long, 17 bytes must be passed to
1219- hid_write(), the Report ID (or 0x0, for devices with a
1220- single report), followed by the report data (16 bytes). In
1221- this example, the length passed in would be 17.
1222-
1223- hid_write() will send the data on the first OUT endpoint, if
1224- one exists. If it does not, it will send the data through
1225- the Control Endpoint (Endpoint 0).
1226-
1227- @ingroup API
1228- @param device A device handle returned from hid_open().
1229- @param data The data to send, including the report number as
1230- the first byte.
1231- @param length The length in bytes of the data to send.
1232-
1233- @returns
1234- This function returns the actual number of bytes written and
1235- -1 on error.
1236- */
1237- int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
1238-
1239- /** @brief Read an Input report from a HID device with timeout.
1240-
1241- Input reports are returned
1242- to the host through the INTERRUPT IN endpoint. The first byte will
1243- contain the Report number if the device uses numbered reports.
1244-
1245- @ingroup API
1246- @param device A device handle returned from hid_open().
1247- @param data A buffer to put the read data into.
1248- @param length The number of bytes to read. For devices with
1249- multiple reports, make sure to read an extra byte for
1250- the report number.
1251- @param milliseconds timeout in milliseconds or -1 for blocking wait.
1252-
1253- @returns
1254- This function returns the actual number of bytes read and
1255- -1 on error.
1256- */
1257- int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
1258-
1259- /** @brief Read an Input report from a HID device.
1260-
1261- Input reports are returned
1262- to the host through the INTERRUPT IN endpoint. The first byte will
1263- contain the Report number if the device uses numbered reports.
1264-
1265- @ingroup API
1266- @param device A device handle returned from hid_open().
1267- @param data A buffer to put the read data into.
1268- @param length The number of bytes to read. For devices with
1269- multiple reports, make sure to read an extra byte for
1270- the report number.
1271-
1272- @returns
1273- This function returns the actual number of bytes read and
1274- -1 on error.
1275- */
1276- int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
1277-
1278- /** @brief Set the device handle to be non-blocking.
1279-
1280- In non-blocking mode calls to hid_read() will return
1281- immediately with a value of 0 if there is no data to be
1282- read. In blocking mode, hid_read() will wait (block) until
1283- there is data to read before returning.
1284-
1285- Nonblocking can be turned on and off at any time.
1286-
1287- @ingroup API
1288- @param device A device handle returned from hid_open().
1289- @param nonblock enable or not the nonblocking reads
1290- - 1 to enable nonblocking
1291- - 0 to disable nonblocking.
1292-
1293- @returns
1294- This function returns 0 on success and -1 on error.
1295- */
1296- int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock);
1297-
1298- /** @brief Send a Feature report to the device.
1299-
1300- Feature reports are sent over the Control endpoint as a
1301- Set_Report transfer. The first byte of @p data[] must
1302- contain the Report ID. For devices which only support a
1303- single report, this must be set to 0x0. The remaining bytes
1304- contain the report data. Since the Report ID is mandatory,
1305- calls to hid_send_feature_report() will always contain one
1306- more byte than the report contains. For example, if a hid
1307- report is 16 bytes long, 17 bytes must be passed to
1308- hid_send_feature_report(): the Report ID (or 0x0, for
1309- devices which do not use numbered reports), followed by the
1310- report data (16 bytes). In this example, the length passed
1311- in would be 17.
1312-
1313- @ingroup API
1314- @param device A device handle returned from hid_open().
1315- @param data The data to send, including the report number as
1316- the first byte.
1317- @param length The length in bytes of the data to send, including
1318- the report number.
1319-
1320- @returns
1321- This function returns the actual number of bytes written and
1322- -1 on error.
1323- */
1324- int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
1325-
1326- /** @brief Get a feature report from a HID device.
1327-
1328- Make sure to set the first byte of @p data[] to the Report
1329- ID of the report to be read. Make sure to allow space for
1330- this extra byte in @p data[].
1331-
1332- @ingroup API
1333- @param device A device handle returned from hid_open().
1334- @param data A buffer to put the read data into, including
1335- the Report ID. Set the first byte of @p data[] to the
1336- Report ID of the report to be read.
1337- @param length The number of bytes to read, including an
1338- extra byte for the report ID. The buffer can be longer
1339- than the actual report.
1340-
1341- @returns
1342- This function returns the number of bytes read and
1343- -1 on error.
1344- */
1345- int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
1346-
1347- /** @brief Close a HID device.
1348-
1349- @ingroup API
1350- @param device A device handle returned from hid_open().
1351- */
1352- void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device);
1353-
1354- /** @brief Get The Manufacturer String from a HID device.
1355-
1356- @ingroup API
1357- @param device A device handle returned from hid_open().
1358- @param string A wide string buffer to put the data into.
1359- @param maxlen The length of the buffer in multiples of wchar_t.
1360-
1361- @returns
1362- This function returns 0 on success and -1 on error.
1363- */
1364- int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
1365-
1366- /** @brief Get The Product String from a HID device.
1367-
1368- @ingroup API
1369- @param device A device handle returned from hid_open().
1370- @param string A wide string buffer to put the data into.
1371- @param maxlen The length of the buffer in multiples of wchar_t.
1372-
1373- @returns
1374- This function returns 0 on success and -1 on error.
1375- */
1376- int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
1377-
1378- /** @brief Get The Serial Number String from a HID device.
1379-
1380- @ingroup API
1381- @param device A device handle returned from hid_open().
1382- @param string A wide string buffer to put the data into.
1383- @param maxlen The length of the buffer in multiples of wchar_t.
1384-
1385- @returns
1386- This function returns 0 on success and -1 on error.
1387- */
1388- int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
1389-
1390- /** @brief Get a string from a HID device, based on its string index.
1391-
1392- @ingroup API
1393- @param device A device handle returned from hid_open().
1394- @param string_index The index of the string to get.
1395- @param string A wide string buffer to put the data into.
1396- @param maxlen The length of the buffer in multiples of wchar_t.
1397-
1398- @returns
1399- This function returns 0 on success and -1 on error.
1400- */
1401- int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
1402-
1403- /** @brief Get a string describing the last error which occurred.
1404-
1405- @ingroup API
1406- @param device A device handle returned from hid_open().
1407-
1408- @returns
1409- This function returns a string containing the last error
1410- which occurred or NULL if none has occurred.
1411- */
1412- HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device);
1413-
1414-#ifdef __cplusplus
1415-}
1416-#endif
1417-
1418-#endif
1419-
1420
1421=== removed directory 'mixxx/lib/hidapi-0.7.0/linux'
1422=== removed file 'mixxx/lib/hidapi-0.7.0/linux/.gitignore'
1423--- mixxx/lib/hidapi-0.7.0/linux/.gitignore 2012-01-28 09:23:48 +0000
1424+++ mixxx/lib/hidapi-0.7.0/linux/.gitignore 1970-01-01 00:00:00 +0000
1425@@ -1,13 +0,0 @@
1426-Debug
1427-Release
1428-*.exp
1429-*.ilk
1430-*.lib
1431-*.suo
1432-*.vcproj.*
1433-*.ncb
1434-*.suo
1435-*.dll
1436-*.pdb
1437-*.o
1438-hidtest
1439\ No newline at end of file
1440
1441=== removed file 'mixxx/lib/hidapi-0.7.0/linux/Makefile'
1442--- mixxx/lib/hidapi-0.7.0/linux/Makefile 2012-01-28 09:23:48 +0000
1443+++ mixxx/lib/hidapi-0.7.0/linux/Makefile 1970-01-01 00:00:00 +0000
1444@@ -1,36 +0,0 @@
1445-###########################################
1446-# Simple Makefile for HIDAPI test program
1447-#
1448-# Alan Ott
1449-# Signal 11 Software
1450-# 2010-06-01
1451-###########################################
1452-
1453-all: hidtest
1454-
1455-CC ?= gcc
1456-CFLAGS ?= -Wall -g
1457-
1458-CXX ?= g++
1459-CXXFLAGS ?= -Wall -g
1460-
1461-COBJS = hid-libusb.o
1462-CPPOBJS = ../hidtest/hidtest.o
1463-OBJS = $(COBJS) $(CPPOBJS)
1464-LIBS = `pkg-config libusb-1.0 libudev --libs`
1465-INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`
1466-
1467-
1468-hidtest: $(OBJS)
1469- $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LIBS) -o hidtest
1470-
1471-$(COBJS): %.o: %.c
1472- $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
1473-
1474-$(CPPOBJS): %.o: %.cpp
1475- $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
1476-
1477-clean:
1478- rm -f $(OBJS) hidtest
1479-
1480-.PHONY: clean
1481
1482=== removed file 'mixxx/lib/hidapi-0.7.0/linux/README.txt'
1483--- mixxx/lib/hidapi-0.7.0/linux/README.txt 2012-01-28 09:23:48 +0000
1484+++ mixxx/lib/hidapi-0.7.0/linux/README.txt 1970-01-01 00:00:00 +0000
1485@@ -1,63 +0,0 @@
1486-
1487-There are two implementations of HIDAPI for Linux. One (hid.c) uses the
1488-Linux hidraw driver, and the other (hid-libusb.c) uses libusb. Which one you
1489-use depends on your application. Complete functionality of the hidraw
1490-version depends on patches to the Linux kernel which are not currently in
1491-the mainline. These patches have to do with sending and receiving feature
1492-reports. The libusb implementation uses libusb to talk directly to the
1493-device, bypassing any Linux HID driver. The disadvantage of the libusb
1494-version is that it will only work with USB devices, while the hidraw
1495-implementation will work with Bluetooth devices as well.
1496-
1497-To use HIDAPI, simply drop either hid.c or hid-libusb.c into your
1498-application and build using the build parameters in the Makefile.
1499-
1500-By default, on Linux, the Makefile in this directory is configured to use
1501-the libusb implementation. To switch to the hidraw implementation, simply
1502-change hid-libusb.c to hid.c in the Makefile.
1503-
1504-
1505-Libusb Implementation notes
1506-----------------------------
1507-For the libusb implementation, libusb-1.0 must be installed. Libusb 1.0 is
1508-different than the legacy libusb 0.1 which is installed on many systems. To
1509-install libusb-1.0 on Ubuntu and other Debian-based systems, run:
1510- sudo apt-get install libusb-1.0-0-dev
1511-
1512-
1513-Hidraw Implementation notes
1514-----------------------------
1515-For the hidraw implementation, libudev headers and libraries are required to
1516-build hidapi programs. To install libudev libraries on Ubuntu,
1517-and other Debian-based systems, run:
1518- sudo apt-get install libudev-dev
1519-
1520-On Redhat-based systems, run the following as root:
1521- yum install libudev-devel
1522-
1523-Unfortunately, the hidraw driver, which the linux version of hidapi is based
1524-on, contains bugs in kernel versions < 2.6.36, which the client application
1525-should be aware of.
1526-
1527-Bugs (hidraw implementation only):
1528------------------------------------
1529-On Kernel versions < 2.6.34, if your device uses numbered reports, an extra
1530-byte will be returned at the beginning of all reports returned from read()
1531-for hidraw devices. This is worked around in the libary. No action should be
1532-necessary in the client library.
1533-
1534-On Kernel versions < 2.6.35, reports will only be sent using a Set_Report
1535-transfer on the CONTROL endpoint. No data will ever be sent on an Interrupt
1536-Out endpoint if one exists. This is fixed in 2.6.35. In 2.6.35, OUTPUT
1537-reports will be sent to the device on the first INTERRUPT OUT endpoint if it
1538-exists; If it does not exist, OUTPUT reports will be sent on the CONTROL
1539-endpoint.
1540-
1541-On Kernel versions < 2.6.36, add an extra byte containing the report number
1542-to sent reports if numbered reports are used, and the device does not
1543-contain an INTERRPUT OUT endpoint for OUTPUT transfers. For example, if
1544-your device uses numbered reports and wants to send {0x2 0xff 0xff 0xff} to
1545-the device (0x2 is the report number), you must send {0x2 0x2 0xff 0xff
1546-0xff}. If your device has the optional Interrupt OUT endpoint, this does not
1547-apply (but really on 2.6.35 only, because 2.6.34 won't use the interrupt
1548-out endpoint).
1549
1550=== removed file 'mixxx/lib/hidapi-0.7.0/linux/hid-libusb.c'
1551--- mixxx/lib/hidapi-0.7.0/linux/hid-libusb.c 2012-05-12 10:43:43 +0000
1552+++ mixxx/lib/hidapi-0.7.0/linux/hid-libusb.c 1970-01-01 00:00:00 +0000
1553@@ -1,1399 +0,0 @@
1554-/*******************************************************
1555- HIDAPI - Multi-Platform library for
1556- communication with HID devices.
1557-
1558- Alan Ott
1559- Signal 11 Software
1560-
1561- 8/22/2009
1562- Linux Version - 6/2/2010
1563- Libusb Version - 8/13/2010
1564-
1565- Copyright 2009, All Rights Reserved.
1566-
1567- At the discretion of the user of this library,
1568- this software may be licensed under the terms of the
1569- GNU Public License v3, a BSD-Style license, or the
1570- original HIDAPI license as outlined in the LICENSE.txt,
1571- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
1572- files located at the root of the source distribution.
1573- These files may also be found in the public source
1574- code repository located at:
1575- http://github.com/signal11/hidapi .
1576-********************************************************/
1577-
1578-#define _GNU_SOURCE // needed for wcsdup() before glibc 2.10
1579-
1580-/* C */
1581-#include <stdio.h>
1582-#include <string.h>
1583-#include <stdlib.h>
1584-#include <ctype.h>
1585-#include <locale.h>
1586-#include <errno.h>
1587-
1588-/* Unix */
1589-#include <unistd.h>
1590-#include <sys/types.h>
1591-#include <sys/stat.h>
1592-#include <sys/ioctl.h>
1593-#include <sys/utsname.h>
1594-#include <fcntl.h>
1595-#include <pthread.h>
1596-#include <wchar.h>
1597-
1598-/* GNU / LibUSB */
1599-#include "libusb.h"
1600-#include "iconv.h"
1601-
1602-#include "hidapi.h"
1603-
1604-#ifdef __cplusplus
1605-extern "C" {
1606-#endif
1607-
1608-#ifdef DEBUG_PRINTF
1609-#define LOG(...) fprintf(stderr, __VA_ARGS__)
1610-#else
1611-#define LOG(...) do {} while (0)
1612-#endif
1613-
1614-
1615-/* Uncomment to enable the retrieval of Usage and Usage Page in
1616-hid_enumerate(). Warning, this is very invasive as it requires the detach
1617-and re-attach of the kernel driver. See comments inside hid_enumerate().
1618-Linux/libusb HIDAPI programs are encouraged to use the interface number
1619-instead to differentiate between interfaces on a composite HID device. */
1620-/*#define INVASIVE_GET_USAGE*/
1621-
1622-/* Linked List of input reports received from the device. */
1623-struct input_report {
1624- uint8_t *data;
1625- size_t len;
1626- struct input_report *next;
1627-};
1628-
1629-
1630-struct hid_device_ {
1631- /* Handle to the actual device. */
1632- libusb_device_handle *device_handle;
1633-
1634- /* Endpoint information */
1635- int input_endpoint;
1636- int output_endpoint;
1637- int input_ep_max_packet_size;
1638-
1639- /* The interface number of the HID */
1640- int interface;
1641-
1642- /* Indexes of Strings */
1643- int manufacturer_index;
1644- int product_index;
1645- int serial_index;
1646-
1647- /* Whether blocking reads are used */
1648- int blocking; /* boolean */
1649-
1650- /* Read thread objects */
1651- pthread_t thread;
1652- pthread_mutex_t mutex; /* Protects input_reports */
1653- pthread_cond_t condition;
1654- pthread_barrier_t barrier; /* Ensures correct startup sequence */
1655- int shutdown_thread;
1656- struct libusb_transfer *transfer;
1657-
1658- /* List of received input reports. */
1659- struct input_report *input_reports;
1660-};
1661-
1662-static int initialized = 0;
1663-
1664-uint16_t get_usb_code_for_current_locale(void);
1665-static int return_data(hid_device *dev, unsigned char *data, size_t length);
1666-
1667-static hid_device *new_hid_device(void)
1668-{
1669- hid_device *dev = calloc(1, sizeof(hid_device));
1670- dev->device_handle = NULL;
1671- dev->input_endpoint = 0;
1672- dev->output_endpoint = 0;
1673- dev->input_ep_max_packet_size = 0;
1674- dev->interface = 0;
1675- dev->manufacturer_index = 0;
1676- dev->product_index = 0;
1677- dev->serial_index = 0;
1678- dev->blocking = 1;
1679- dev->shutdown_thread = 0;
1680- dev->transfer = NULL;
1681- dev->input_reports = NULL;
1682-
1683- pthread_mutex_init(&dev->mutex, NULL);
1684- pthread_cond_init(&dev->condition, NULL);
1685- pthread_barrier_init(&dev->barrier, NULL, 2);
1686-
1687- return dev;
1688-}
1689-
1690-static void free_hid_device(hid_device *dev)
1691-{
1692- /* Clean up the thread objects */
1693- pthread_barrier_destroy(&dev->barrier);
1694- pthread_cond_destroy(&dev->condition);
1695- pthread_mutex_destroy(&dev->mutex);
1696-
1697- /* Free the device itself */
1698- free(dev);
1699-}
1700-
1701-#if 0
1702-//TODO: Implement this funciton on Linux.
1703-static void register_error(hid_device *device, const char *op)
1704-{
1705-
1706-}
1707-#endif
1708-
1709-#ifdef INVASIVE_GET_USAGE
1710-/* Get bytes from a HID Report Descriptor.
1711- Only call with a num_bytes of 0, 1, 2, or 4. */
1712-static uint32_t get_bytes(uint8_t *rpt, size_t len, size_t num_bytes, size_t cur)
1713-{
1714- /* Return if there aren't enough bytes. */
1715- if (cur + num_bytes >= len)
1716- return 0;
1717-
1718- if (num_bytes == 0)
1719- return 0;
1720- else if (num_bytes == 1) {
1721- return rpt[cur+1];
1722- }
1723- else if (num_bytes == 2) {
1724- return (rpt[cur+2] * 256 + rpt[cur+1]);
1725- }
1726- else if (num_bytes == 4) {
1727- return (rpt[cur+4] * 0x01000000 +
1728- rpt[cur+3] * 0x00010000 +
1729- rpt[cur+2] * 0x00000100 +
1730- rpt[cur+1] * 0x00000001);
1731- }
1732- else
1733- return 0;
1734-}
1735-
1736-/* Retrieves the device's Usage Page and Usage from the report
1737- descriptor. The algorithm is simple, as it just returns the first
1738- Usage and Usage Page that it finds in the descriptor.
1739- The return value is 0 on success and -1 on failure. */
1740-static int get_usage(uint8_t *report_descriptor, size_t size,
1741- unsigned short *usage_page, unsigned short *usage)
1742-{
1743- int i = 0;
1744- int size_code;
1745- int data_len, key_size;
1746- int usage_found = 0, usage_page_found = 0;
1747-
1748- while (i < size) {
1749- int key = report_descriptor[i];
1750- int key_cmd = key & 0xfc;
1751-
1752- //printf("key: %02hhx\n", key);
1753-
1754- if ((key & 0xf0) == 0xf0) {
1755- /* This is a Long Item. The next byte contains the
1756- length of the data section (value) for this key.
1757- See the HID specification, version 1.11, section
1758- 6.2.2.3, titled "Long Items." */
1759- if (i+1 < size)
1760- data_len = report_descriptor[i+1];
1761- else
1762- data_len = 0; /* malformed report */
1763- key_size = 3;
1764- }
1765- else {
1766- /* This is a Short Item. The bottom two bits of the
1767- key contain the size code for the data section
1768- (value) for this key. Refer to the HID
1769- specification, version 1.11, section 6.2.2.2,
1770- titled "Short Items." */
1771- size_code = key & 0x3;
1772- switch (size_code) {
1773- case 0:
1774- case 1:
1775- case 2:
1776- data_len = size_code;
1777- break;
1778- case 3:
1779- data_len = 4;
1780- break;
1781- default:
1782- /* Can't ever happen since size_code is & 0x3 */
1783- data_len = 0;
1784- break;
1785- };
1786- key_size = 1;
1787- }
1788-
1789- if (key_cmd == 0x4) {
1790- *usage_page = get_bytes(report_descriptor, size, data_len, i);
1791- usage_page_found = 1;
1792- //printf("Usage Page: %x\n", (uint32_t)*usage_page);
1793- }
1794- if (key_cmd == 0x8) {
1795- *usage = get_bytes(report_descriptor, size, data_len, i);
1796- usage_found = 1;
1797- //printf("Usage: %x\n", (uint32_t)*usage);
1798- }
1799-
1800- if (usage_page_found && usage_found)
1801- return 0; /* success */
1802-
1803- /* Skip over this key and it's associated data */
1804- i += data_len + key_size;
1805- }
1806-
1807- return -1; /* failure */
1808-}
1809-#endif // INVASIVE_GET_USAGE
1810-
1811-
1812-/* Get the first language the device says it reports. This comes from
1813- USB string #0. */
1814-static uint16_t get_first_language(libusb_device_handle *dev)
1815-{
1816- uint16_t buf[32];
1817- int len;
1818-
1819- /* Get the string from libusb. */
1820- len = libusb_get_string_descriptor(dev,
1821- 0x0, /* String ID */
1822- 0x0, /* Language */
1823- (unsigned char*)buf,
1824- sizeof(buf));
1825- if (len < 4)
1826- return 0x0;
1827-
1828- return buf[1]; // First two bytes are len and descriptor type.
1829-}
1830-
1831-static int is_language_supported(libusb_device_handle *dev, uint16_t lang)
1832-{
1833- uint16_t buf[32];
1834- int len;
1835- int i;
1836-
1837- /* Get the string from libusb. */
1838- len = libusb_get_string_descriptor(dev,
1839- 0x0, /* String ID */
1840- 0x0, /* Language */
1841- (unsigned char*)buf,
1842- sizeof(buf));
1843- if (len < 4)
1844- return 0x0;
1845-
1846-
1847- len /= 2; /* language IDs are two-bytes each. */
1848- /* Start at index 1 because there are two bytes of protocol data. */
1849- for (i = 1; i < len; i++) {
1850- if (buf[i] == lang)
1851- return 1;
1852- }
1853-
1854- return 0;
1855-}
1856-
1857-
1858-/* This function returns a newly allocated wide string containing the USB
1859- device string numbered by the index. The returned string must be freed
1860- by using free(). */
1861-static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
1862-{
1863- char buf[512];
1864- int len;
1865- wchar_t *str = NULL;
1866- wchar_t wbuf[256];
1867-
1868- /* iconv variables */
1869- iconv_t ic;
1870- size_t inbytes;
1871- size_t outbytes;
1872- size_t res;
1873- char *inptr;
1874- char *outptr;
1875-
1876- /* Determine which language to use. */
1877- uint16_t lang;
1878- lang = get_usb_code_for_current_locale();
1879- if (!is_language_supported(dev, lang))
1880- lang = get_first_language(dev);
1881-
1882- /* Get the string from libusb. */
1883- len = libusb_get_string_descriptor(dev,
1884- idx,
1885- lang,
1886- (unsigned char*)buf,
1887- sizeof(buf));
1888- if (len < 0)
1889- return NULL;
1890-
1891- buf[sizeof(buf)-1] = '\0';
1892-
1893- if (len+1 < sizeof(buf))
1894- buf[len+1] = '\0';
1895-
1896- /* Initialize iconv. */
1897- ic = iconv_open("UTF-32", "UTF-16");
1898- if (ic == (iconv_t)-1)
1899- return NULL;
1900-
1901- /* Convert to UTF-32 (wchar_t on glibc systems).
1902- Skip the first character (2-bytes). */
1903- inptr = buf+2;
1904- inbytes = len-2;
1905- outptr = (char*) wbuf;
1906- outbytes = sizeof(wbuf);
1907- res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes);
1908- if (res == (size_t)-1)
1909- goto err;
1910-
1911- /* Write the terminating NULL. */
1912- wbuf[sizeof(wbuf)/sizeof(wbuf[0])-1] = 0x00000000;
1913- if (outbytes >= sizeof(wbuf[0]))
1914- *((wchar_t*)outptr) = 0x00000000;
1915-
1916- /* Allocate and copy the string. */
1917- str = wcsdup(wbuf+1);
1918-
1919-err:
1920- iconv_close(ic);
1921-
1922- return str;
1923-}
1924-
1925-static char *make_path(libusb_device *dev, int interface_number)
1926-{
1927- char str[64];
1928- snprintf(str, sizeof(str), "%04x:%04x:%02x",
1929- libusb_get_bus_number(dev),
1930- libusb_get_device_address(dev),
1931- interface_number);
1932- str[sizeof(str)-1] = '\0';
1933-
1934- return strdup(str);
1935-}
1936-
1937-
1938-int HID_API_EXPORT hid_init(void)
1939-{
1940- if (!initialized) {
1941- if (libusb_init(NULL))
1942- return -1;
1943- initialized = 1;
1944- }
1945-
1946- return 0;
1947-}
1948-
1949-int HID_API_EXPORT hid_exit(void)
1950-{
1951- if (initialized) {
1952- libusb_exit(NULL);
1953- initialized = 0;
1954- }
1955-
1956- return 0;
1957-}
1958-
1959-struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id)
1960-{
1961- libusb_device **devs;
1962- libusb_device *dev;
1963- libusb_device_handle *handle;
1964- ssize_t num_devs;
1965- int i = 0;
1966-
1967- struct hid_device_info *root = NULL; // return object
1968- struct hid_device_info *cur_dev = NULL;
1969-
1970- setlocale(LC_ALL,"");
1971-
1972- if (!initialized)
1973- hid_init();
1974-
1975- num_devs = libusb_get_device_list(NULL, &devs);
1976- if (num_devs < 0)
1977- return NULL;
1978- while ((dev = devs[i++]) != NULL) {
1979- struct libusb_device_descriptor desc;
1980- struct libusb_config_descriptor *conf_desc = NULL;
1981- int j, k;
1982- int interface_num = 0;
1983-
1984- int res = libusb_get_device_descriptor(dev, &desc);
1985- unsigned short dev_vid = desc.idVendor;
1986- unsigned short dev_pid = desc.idProduct;
1987-
1988- /* HID's are defined at the interface level. */
1989- if (desc.bDeviceClass != LIBUSB_CLASS_PER_INTERFACE)
1990- continue;
1991-
1992- res = libusb_get_active_config_descriptor(dev, &conf_desc);
1993- if (res < 0)
1994- libusb_get_config_descriptor(dev, 0, &conf_desc);
1995- if (conf_desc) {
1996- for (j = 0; j < conf_desc->bNumInterfaces; j++) {
1997- const struct libusb_interface *intf = &conf_desc->interface[j];
1998- for (k = 0; k < intf->num_altsetting; k++) {
1999- const struct libusb_interface_descriptor *intf_desc;
2000- intf_desc = &intf->altsetting[k];
2001- if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) {
2002- interface_num = intf_desc->bInterfaceNumber;
2003-
2004- /* Check the VID/PID against the arguments */
2005- if ((vendor_id == 0x0 && product_id == 0x0) ||
2006- (vendor_id == dev_vid && product_id == dev_pid)) {
2007- struct hid_device_info *tmp;
2008-
2009- /* VID/PID match. Create the record. */
2010- tmp = calloc(1, sizeof(struct hid_device_info));
2011- if (cur_dev) {
2012- cur_dev->next = tmp;
2013- }
2014- else {
2015- root = tmp;
2016- }
2017- cur_dev = tmp;
2018-
2019- /* Fill out the record */
2020- cur_dev->next = NULL;
2021- cur_dev->path = make_path(dev, interface_num);
2022-
2023- res = libusb_open(dev, &handle);
2024-
2025- if (res >= 0) {
2026- /* Serial Number */
2027- if (desc.iSerialNumber > 0)
2028- cur_dev->serial_number =
2029- get_usb_string(handle, desc.iSerialNumber);
2030-
2031- /* Manufacturer and Product strings */
2032- if (desc.iManufacturer > 0)
2033- cur_dev->manufacturer_string =
2034- get_usb_string(handle, desc.iManufacturer);
2035- if (desc.iProduct > 0)
2036- cur_dev->product_string =
2037- get_usb_string(handle, desc.iProduct);
2038-
2039-#ifdef INVASIVE_GET_USAGE
2040- /*
2041- This section is removed because it is too
2042- invasive on the system. Getting a Usage Page
2043- and Usage requires parsing the HID Report
2044- descriptor. Getting a HID Report descriptor
2045- involves claiming the interface. Claiming the
2046- interface involves detaching the kernel driver.
2047- Detaching the kernel driver is hard on the system
2048- because it will unclaim interfaces (if another
2049- app has them claimed) and the re-attachment of
2050- the driver will sometimes change /dev entry names.
2051- It is for these reasons that this section is
2052- #if 0. For composite devices, use the interface
2053- field in the hid_device_info struct to distinguish
2054- between interfaces. */
2055- int detached = 0;
2056- unsigned char data[256];
2057-
2058- /* Usage Page and Usage */
2059- res = libusb_kernel_driver_active(handle, interface_num);
2060- if (res == 1) {
2061- res = libusb_detach_kernel_driver(handle, interface_num);
2062- if (res < 0)
2063- LOG("Couldn't detach kernel driver, even though a kernel driver was attached.");
2064- else
2065- detached = 1;
2066- }
2067- res = libusb_claim_interface(handle, interface_num);
2068- if (res >= 0) {
2069- /* Get the HID Report Descriptor. */
2070- res = libusb_control_transfer(handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8)|interface_num, 0, data, sizeof(data), 5000);
2071- if (res >= 0) {
2072- unsigned short page=0, usage=0;
2073- /* Parse the usage and usage page
2074- out of the report descriptor. */
2075- get_usage(data, res, &page, &usage);
2076- cur_dev->usage_page = page;
2077- cur_dev->usage = usage;
2078- }
2079- else
2080- LOG("libusb_control_transfer() for getting the HID report failed with %d\n", res);
2081-
2082- /* Release the interface */
2083- res = libusb_release_interface(handle, interface_num);
2084- if (res < 0)
2085- LOG("Can't release the interface.\n");
2086- }
2087- else
2088- LOG("Can't claim interface %d\n", res);
2089-
2090- /* Re-attach kernel driver if necessary. */
2091- if (detached) {
2092- res = libusb_attach_kernel_driver(handle, interface_num);
2093- if (res < 0)
2094- LOG("Couldn't re-attach kernel driver.\n");
2095- }
2096-#endif /*******************/
2097-
2098- libusb_close(handle);
2099- }
2100- /* VID/PID */
2101- cur_dev->vendor_id = dev_vid;
2102- cur_dev->product_id = dev_pid;
2103-
2104- /* Release Number */
2105- cur_dev->release_number = desc.bcdDevice;
2106-
2107- /* Interface Number */
2108- cur_dev->interface_number = interface_num;
2109- }
2110- }
2111- } /* altsettings */
2112- } /* interfaces */
2113- libusb_free_config_descriptor(conf_desc);
2114- }
2115- }
2116-
2117- libusb_free_device_list(devs, 1);
2118-
2119- return root;
2120-}
2121-
2122-void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs)
2123-{
2124- struct hid_device_info *d = devs;
2125- while (d) {
2126- struct hid_device_info *next = d->next;
2127- free(d->path);
2128- free(d->serial_number);
2129- free(d->manufacturer_string);
2130- free(d->product_string);
2131- free(d);
2132- d = next;
2133- }
2134-}
2135-
2136-hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number)
2137-{
2138- struct hid_device_info *devs, *cur_dev;
2139- const char *path_to_open = NULL;
2140- hid_device *handle = NULL;
2141-
2142- devs = hid_enumerate(vendor_id, product_id);
2143- cur_dev = devs;
2144- while (cur_dev) {
2145- if (cur_dev->vendor_id == vendor_id &&
2146- cur_dev->product_id == product_id) {
2147- if (serial_number) {
2148- if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
2149- path_to_open = cur_dev->path;
2150- break;
2151- }
2152- }
2153- else {
2154- path_to_open = cur_dev->path;
2155- break;
2156- }
2157- }
2158- cur_dev = cur_dev->next;
2159- }
2160-
2161- if (path_to_open) {
2162- /* Open the device */
2163- handle = hid_open_path(path_to_open);
2164- }
2165-
2166- hid_free_enumeration(devs);
2167-
2168- return handle;
2169-}
2170-
2171-static void read_callback(struct libusb_transfer *transfer)
2172-{
2173- hid_device *dev = transfer->user_data;
2174-
2175- if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
2176-
2177- struct input_report *rpt = malloc(sizeof(*rpt));
2178- rpt->data = malloc(transfer->actual_length);
2179- memcpy(rpt->data, transfer->buffer, transfer->actual_length);
2180- rpt->len = transfer->actual_length;
2181- rpt->next = NULL;
2182-
2183- pthread_mutex_lock(&dev->mutex);
2184-
2185- /* Attach the new report object to the end of the list. */
2186- if (dev->input_reports == NULL) {
2187- /* The list is empty. Put it at the root. */
2188- dev->input_reports = rpt;
2189- pthread_cond_signal(&dev->condition);
2190- }
2191- else {
2192- /* Find the end of the list and attach. */
2193- struct input_report *cur = dev->input_reports;
2194- int num_queued = 0;
2195- while (cur->next != NULL) {
2196- cur = cur->next;
2197- num_queued++;
2198- }
2199- cur->next = rpt;
2200-
2201- /* Pop one off if we've reached 30 in the queue. This
2202- way we don't grow forever if the user never reads
2203- anything from the device. */
2204- if (num_queued > 30) {
2205- return_data(dev, NULL, 0);
2206- }
2207- }
2208- pthread_mutex_unlock(&dev->mutex);
2209- }
2210- else if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
2211- dev->shutdown_thread = 1;
2212- return;
2213- }
2214- else if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
2215- dev->shutdown_thread = 1;
2216- return;
2217- }
2218- else if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT) {
2219- //LOG("Timeout (normal)\n");
2220- }
2221- else {
2222- LOG("Unknown transfer code: %d\n", transfer->status);
2223- }
2224-
2225- /* Re-submit the transfer object. */
2226- libusb_submit_transfer(transfer);
2227-}
2228-
2229-
2230-static void *read_thread(void *param)
2231-{
2232- hid_device *dev = param;
2233- unsigned char *buf;
2234- const size_t length = dev->input_ep_max_packet_size;
2235-
2236- /* Set up the transfer object. */
2237- buf = malloc(length);
2238- dev->transfer = libusb_alloc_transfer(0);
2239- libusb_fill_interrupt_transfer(dev->transfer,
2240- dev->device_handle,
2241- dev->input_endpoint,
2242- buf,
2243- length,
2244- read_callback,
2245- dev,
2246- 5000/*timeout*/);
2247-
2248- /* Make the first submission. Further submissions are made
2249- from inside read_callback() */
2250- libusb_submit_transfer(dev->transfer);
2251-
2252- // Notify the main thread that the read thread is up and running.
2253- pthread_barrier_wait(&dev->barrier);
2254-
2255- /* Handle all the events. */
2256- while (!dev->shutdown_thread) {
2257- int res;
2258- res = libusb_handle_events(NULL);
2259- if (res < 0) {
2260- /* There was an error. */
2261- LOG("libusb reports error # %d\n", res);
2262- /* Should call libusb_error_name() to get the string version but
2263- the compiler doesn't recognize that function for some reason */
2264-
2265- /* Break out of this loop only on fatal error conditions.
2266- See the list at:
2267- http://libusb.sourceforge.net/api-1.0/group__misc.html#gab2323aa0f04bc22038e7e1740b2f29ef
2268- */
2269- if (res != LIBUSB_ERROR_BUSY &&
2270- res != LIBUSB_ERROR_TIMEOUT &&
2271- res != LIBUSB_ERROR_OVERFLOW &&
2272- res != LIBUSB_ERROR_INTERRUPTED) {
2273- break;
2274- }
2275- }
2276- }
2277-
2278- /* Cancel any transfer that may be pending. This call will fail
2279- if no transfers are pending, but that's OK. */
2280- if (libusb_cancel_transfer(dev->transfer) == 0) {
2281- /* The transfer was cancelled, so wait for its completion. */
2282- libusb_handle_events(NULL);
2283- }
2284-
2285- /* Now that the read thread is stopping, Wake any threads which are
2286- waiting on data (in hid_read_timeout()). Do this under a mutex to
2287- make sure that a thread which is about to go to sleep waiting on
2288- the condition acutally will go to sleep before the condition is
2289- signaled. */
2290- pthread_mutex_lock(&dev->mutex);
2291- pthread_cond_broadcast(&dev->condition);
2292- pthread_mutex_unlock(&dev->mutex);
2293-
2294- /* The dev->transfer->buffer and dev->transfer objects are cleaned up
2295- in hid_close(). They are not cleaned up here because this thread
2296- could end either due to a disconnect or due to a user
2297- call to hid_close(). In both cases the objects can be safely
2298- cleaned up after the call to pthread_join() (in hid_close()), but
2299- since hid_close() calls libusb_cancel_transfer(), on these objects,
2300- they can not be cleaned up here. */
2301-
2302- return NULL;
2303-}
2304-
2305-
2306-hid_device * HID_API_EXPORT hid_open_path(const char *path)
2307-{
2308- hid_device *dev = NULL;
2309-
2310- dev = new_hid_device();
2311-
2312- libusb_device **devs;
2313- libusb_device *usb_dev;
2314- ssize_t num_devs;
2315- int res;
2316- int d = 0;
2317- int good_open = 0;
2318-
2319- setlocale(LC_ALL,"");
2320-
2321- if (!initialized)
2322- hid_init();
2323-
2324- num_devs = libusb_get_device_list(NULL, &devs);
2325- while ((usb_dev = devs[d++]) != NULL) {
2326- struct libusb_device_descriptor desc;
2327- struct libusb_config_descriptor *conf_desc = NULL;
2328- int i,j,k;
2329- libusb_get_device_descriptor(usb_dev, &desc);
2330-
2331- if (libusb_get_active_config_descriptor(usb_dev, &conf_desc) < 0)
2332- continue;
2333- for (j = 0; j < conf_desc->bNumInterfaces; j++) {
2334- const struct libusb_interface *intf = &conf_desc->interface[j];
2335- for (k = 0; k < intf->num_altsetting; k++) {
2336- const struct libusb_interface_descriptor *intf_desc;
2337- intf_desc = &intf->altsetting[k];
2338- if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) {
2339- char *dev_path = make_path(usb_dev, intf_desc->bInterfaceNumber);
2340- if (!strcmp(dev_path, path)) {
2341- /* Matched Paths. Open this device */
2342-
2343- // OPEN HERE //
2344- res = libusb_open(usb_dev, &dev->device_handle);
2345- if (res < 0) {
2346- LOG("can't open device\n");
2347- free(dev_path);
2348- break;
2349- }
2350- good_open = 1;
2351-
2352- /* Detach the kernel driver, but only if the
2353- device is managed by the kernel */
2354- if (libusb_kernel_driver_active(dev->device_handle, intf_desc->bInterfaceNumber) == 1) {
2355- res = libusb_detach_kernel_driver(dev->device_handle, intf_desc->bInterfaceNumber);
2356- if (res < 0) {
2357- libusb_close(dev->device_handle);
2358- LOG("Unable to detach Kernel Driver\n");
2359- free(dev_path);
2360- good_open = 0;
2361- break;
2362- }
2363- }
2364-
2365- res = libusb_claim_interface(dev->device_handle, intf_desc->bInterfaceNumber);
2366- if (res < 0) {
2367- LOG("can't claim interface %d: %d\n", intf_desc->bInterfaceNumber, res);
2368- free(dev_path);
2369- libusb_close(dev->device_handle);
2370- good_open = 0;
2371- break;
2372- }
2373-
2374- /* Store off the string descriptor indexes */
2375- dev->manufacturer_index = desc.iManufacturer;
2376- dev->product_index = desc.iProduct;
2377- dev->serial_index = desc.iSerialNumber;
2378-
2379- /* Store off the interface number */
2380- dev->interface = intf_desc->bInterfaceNumber;
2381-
2382- /* Find the INPUT and OUTPUT endpoints. An
2383- OUTPUT endpoint is not required. */
2384- for (i = 0; i < intf_desc->bNumEndpoints; i++) {
2385- const struct libusb_endpoint_descriptor *ep
2386- = &intf_desc->endpoint[i];
2387-
2388- /* Determine the type and direction of this
2389- endpoint. */
2390- int is_interrupt =
2391- (ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK)
2392- == LIBUSB_TRANSFER_TYPE_INTERRUPT;
2393- int is_output =
2394- (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK)
2395- == LIBUSB_ENDPOINT_OUT;
2396- int is_input =
2397- (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK)
2398- == LIBUSB_ENDPOINT_IN;
2399-
2400- /* Decide whether to use it for intput or output. */
2401- if (dev->input_endpoint == 0 &&
2402- is_interrupt && is_input) {
2403- /* Use this endpoint for INPUT */
2404- dev->input_endpoint = ep->bEndpointAddress;
2405- dev->input_ep_max_packet_size = ep->wMaxPacketSize;
2406- }
2407- if (dev->output_endpoint == 0 &&
2408- is_interrupt && is_output) {
2409- /* Use this endpoint for OUTPUT */
2410- dev->output_endpoint = ep->bEndpointAddress;
2411- }
2412- }
2413-
2414- pthread_create(&dev->thread, NULL, read_thread, dev);
2415-
2416- // Wait here for the read thread to be initialized.
2417- pthread_barrier_wait(&dev->barrier);
2418-
2419- }
2420- free(dev_path);
2421- }
2422- }
2423- }
2424- libusb_free_config_descriptor(conf_desc);
2425-
2426- }
2427-
2428- libusb_free_device_list(devs, 1);
2429-
2430- // If we have a good handle, return it.
2431- if (good_open) {
2432- return dev;
2433- }
2434- else {
2435- // Unable to open any devices.
2436- free_hid_device(dev);
2437- return NULL;
2438- }
2439-}
2440-
2441-
2442-int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
2443-{
2444- int res;
2445- int report_number = data[0];
2446- int skipped_report_id = 0;
2447-
2448- if (report_number == 0x0) {
2449- data++;
2450- length--;
2451- skipped_report_id = 1;
2452- }
2453-
2454-
2455- if (dev->output_endpoint <= 0) {
2456- /* No interrput out endpoint. Use the Control Endpoint */
2457- res = libusb_control_transfer(dev->device_handle,
2458- LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
2459- 0x09/*HID Set_Report*/,
2460- (2/*HID output*/ << 8) | report_number,
2461- dev->interface,
2462- (unsigned char *)data, length,
2463- 1000/*timeout millis*/);
2464-
2465- if (res < 0)
2466- return -1;
2467-
2468- if (skipped_report_id)
2469- length++;
2470-
2471- return length;
2472- }
2473- else {
2474- /* Use the interrupt out endpoint */
2475- int actual_length;
2476- res = libusb_interrupt_transfer(dev->device_handle,
2477- dev->output_endpoint,
2478- (unsigned char*)data,
2479- length,
2480- &actual_length, 1000);
2481-
2482- if (res < 0)
2483- return -1;
2484-
2485- if (skipped_report_id)
2486- actual_length++;
2487-
2488- return actual_length;
2489- }
2490-}
2491-
2492-/* Helper function, to simplify hid_read().
2493- This should be called with dev->mutex locked. */
2494-static int return_data(hid_device *dev, unsigned char *data, size_t length)
2495-{
2496- /* Copy the data out of the linked list item (rpt) into the
2497- return buffer (data), and delete the liked list item. */
2498- struct input_report *rpt = dev->input_reports;
2499- size_t len = (length < rpt->len)? length: rpt->len;
2500- if (len > 0)
2501- memcpy(data, rpt->data, len);
2502- dev->input_reports = rpt->next;
2503- free(rpt->data);
2504- free(rpt);
2505- return len;
2506-}
2507-
2508-static void cleanup_mutex(void *param)
2509-{
2510- hid_device *dev = param;
2511- pthread_mutex_unlock(&dev->mutex);
2512-}
2513-
2514-
2515-int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
2516-{
2517- int bytes_read = -1;
2518-
2519-#if 0
2520- int transferred;
2521- int res = libusb_interrupt_transfer(dev->device_handle, dev->input_endpoint, data, length, &transferred, 5000);
2522- LOG("transferred: %d\n", transferred);
2523- return transferred;
2524-#endif
2525-
2526- pthread_mutex_lock(&dev->mutex);
2527- pthread_cleanup_push(&cleanup_mutex, dev);
2528-
2529- /* There's an input report queued up. Return it. */
2530- if (dev->input_reports) {
2531- /* Return the first one */
2532- bytes_read = return_data(dev, data, length);
2533- goto ret;
2534- }
2535-
2536- if (dev->shutdown_thread) {
2537- /* This means the device has been disconnected.
2538- An error code of -1 should be returned. */
2539- bytes_read = -1;
2540- goto ret;
2541- }
2542-
2543- if (milliseconds == -1) {
2544- /* Blocking */
2545- while (!dev->input_reports && !dev->shutdown_thread) {
2546- pthread_cond_wait(&dev->condition, &dev->mutex);
2547- }
2548- if (dev->input_reports) {
2549- bytes_read = return_data(dev, data, length);
2550- }
2551- }
2552- else if (milliseconds > 0) {
2553- /* Non-blocking, but called with timeout. */
2554- int res;
2555- struct timespec ts;
2556- clock_gettime(CLOCK_REALTIME, &ts);
2557- ts.tv_sec += milliseconds / 1000;
2558- ts.tv_nsec += (milliseconds % 1000) * 1000000;
2559- if (ts.tv_nsec >= 1000000000L) {
2560- ts.tv_sec++;
2561- ts.tv_nsec -= 1000000000L;
2562- }
2563-
2564- while (!dev->input_reports && !dev->shutdown_thread) {
2565- res = pthread_cond_timedwait(&dev->condition, &dev->mutex, &ts);
2566- if (res == 0) {
2567- if (dev->input_reports) {
2568- bytes_read = return_data(dev, data, length);
2569- break;
2570- }
2571-
2572- /* If we're here, there was a spurious wake up
2573- or the read thread was shutdown. Run the
2574- loop again (ie: don't break). */
2575- }
2576- else if (res == ETIMEDOUT) {
2577- /* Timed out. */
2578- bytes_read = 0;
2579- break;
2580- }
2581- else {
2582- /* Error. */
2583- bytes_read = -1;
2584- break;
2585- }
2586- }
2587- }
2588- else {
2589- /* Purely non-blocking */
2590- bytes_read = 0;
2591- }
2592-
2593-ret:
2594- pthread_mutex_unlock(&dev->mutex);
2595- pthread_cleanup_pop(0);
2596-
2597- return bytes_read;
2598-}
2599-
2600-int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length)
2601-{
2602- return hid_read_timeout(dev, data, length, dev->blocking ? -1 : 0);
2603-}
2604-
2605-int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
2606-{
2607- dev->blocking = !nonblock;
2608-
2609- return 0;
2610-}
2611-
2612-
2613-int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
2614-{
2615- int res = -1;
2616- int skipped_report_id = 0;
2617- int report_number = data[0];
2618-
2619- if (report_number == 0x0) {
2620- data++;
2621- length--;
2622- skipped_report_id = 1;
2623- }
2624-
2625- res = libusb_control_transfer(dev->device_handle,
2626- LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_OUT,
2627- 0x09/*HID set_report*/,
2628- (3/*HID feature*/ << 8) | report_number,
2629- dev->interface,
2630- (unsigned char *)data, length,
2631- 1000/*timeout millis*/);
2632-
2633- if (res < 0)
2634- return -1;
2635-
2636- /* Account for the report ID */
2637- if (skipped_report_id)
2638- length++;
2639-
2640- return length;
2641-}
2642-
2643-int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
2644-{
2645- int res = -1;
2646- int skipped_report_id = 0;
2647- int report_number = data[0];
2648-
2649- if (report_number == 0x0) {
2650- /* Offset the return buffer by 1, so that the report ID
2651- will remain in byte 0. */
2652- data++;
2653- length--;
2654- skipped_report_id = 1;
2655- }
2656- res = libusb_control_transfer(dev->device_handle,
2657- LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE|LIBUSB_ENDPOINT_IN,
2658- 0x01/*HID get_report*/,
2659- (3/*HID feature*/ << 8) | report_number,
2660- dev->interface,
2661- (unsigned char *)data, length,
2662- 1000/*timeout millis*/);
2663-
2664- if (res < 0)
2665- return -1;
2666-
2667- if (skipped_report_id)
2668- res++;
2669-
2670- return res;
2671-}
2672-
2673-
2674-void HID_API_EXPORT hid_close(hid_device *dev)
2675-{
2676- if (!dev)
2677- return;
2678-
2679- /* Cause read_thread() to stop. */
2680- dev->shutdown_thread = 1;
2681- libusb_cancel_transfer(dev->transfer);
2682-
2683- /* Wait for read_thread() to end. */
2684- pthread_join(dev->thread, NULL);
2685-
2686- /* Clean up the Transfer objects allocated in read_thread(). */
2687- free(dev->transfer->buffer);
2688- libusb_free_transfer(dev->transfer);
2689-
2690- /* release the interface */
2691- libusb_release_interface(dev->device_handle, dev->interface);
2692-
2693- /* Close the handle */
2694- libusb_close(dev->device_handle);
2695-
2696- /* Clear out the queue of received reports. */
2697- pthread_mutex_lock(&dev->mutex);
2698- while (dev->input_reports) {
2699- return_data(dev, NULL, 0);
2700- }
2701- pthread_mutex_unlock(&dev->mutex);
2702-
2703- free_hid_device(dev);
2704-}
2705-
2706-
2707-int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
2708-{
2709- return hid_get_indexed_string(dev, dev->manufacturer_index, string, maxlen);
2710-}
2711-
2712-int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
2713-{
2714- return hid_get_indexed_string(dev, dev->product_index, string, maxlen);
2715-}
2716-
2717-int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
2718-{
2719- return hid_get_indexed_string(dev, dev->serial_index, string, maxlen);
2720-}
2721-
2722-int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
2723-{
2724- wchar_t *str;
2725-
2726- str = get_usb_string(dev->device_handle, string_index);
2727- if (str) {
2728- wcsncpy(string, str, maxlen);
2729- string[maxlen-1] = L'\0';
2730- free(str);
2731- return 0;
2732- }
2733- else
2734- return -1;
2735-}
2736-
2737-
2738-HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
2739-{
2740- return NULL;
2741-}
2742-
2743-
2744-struct lang_map_entry {
2745- const char *name;
2746- const char *string_code;
2747- uint16_t usb_code;
2748-};
2749-
2750-#define LANG(name,code,usb_code) { name, code, usb_code }
2751-static struct lang_map_entry lang_map[] = {
2752- LANG("Afrikaans", "af", 0x0436),
2753- LANG("Albanian", "sq", 0x041C),
2754- LANG("Arabic - United Arab Emirates", "ar_ae", 0x3801),
2755- LANG("Arabic - Bahrain", "ar_bh", 0x3C01),
2756- LANG("Arabic - Algeria", "ar_dz", 0x1401),
2757- LANG("Arabic - Egypt", "ar_eg", 0x0C01),
2758- LANG("Arabic - Iraq", "ar_iq", 0x0801),
2759- LANG("Arabic - Jordan", "ar_jo", 0x2C01),
2760- LANG("Arabic - Kuwait", "ar_kw", 0x3401),
2761- LANG("Arabic - Lebanon", "ar_lb", 0x3001),
2762- LANG("Arabic - Libya", "ar_ly", 0x1001),
2763- LANG("Arabic - Morocco", "ar_ma", 0x1801),
2764- LANG("Arabic - Oman", "ar_om", 0x2001),
2765- LANG("Arabic - Qatar", "ar_qa", 0x4001),
2766- LANG("Arabic - Saudi Arabia", "ar_sa", 0x0401),
2767- LANG("Arabic - Syria", "ar_sy", 0x2801),
2768- LANG("Arabic - Tunisia", "ar_tn", 0x1C01),
2769- LANG("Arabic - Yemen", "ar_ye", 0x2401),
2770- LANG("Armenian", "hy", 0x042B),
2771- LANG("Azeri - Latin", "az_az", 0x042C),
2772- LANG("Azeri - Cyrillic", "az_az", 0x082C),
2773- LANG("Basque", "eu", 0x042D),
2774- LANG("Belarusian", "be", 0x0423),
2775- LANG("Bulgarian", "bg", 0x0402),
2776- LANG("Catalan", "ca", 0x0403),
2777- LANG("Chinese - China", "zh_cn", 0x0804),
2778- LANG("Chinese - Hong Kong SAR", "zh_hk", 0x0C04),
2779- LANG("Chinese - Macau SAR", "zh_mo", 0x1404),
2780- LANG("Chinese - Singapore", "zh_sg", 0x1004),
2781- LANG("Chinese - Taiwan", "zh_tw", 0x0404),
2782- LANG("Croatian", "hr", 0x041A),
2783- LANG("Czech", "cs", 0x0405),
2784- LANG("Danish", "da", 0x0406),
2785- LANG("Dutch - Netherlands", "nl_nl", 0x0413),
2786- LANG("Dutch - Belgium", "nl_be", 0x0813),
2787- LANG("English - Australia", "en_au", 0x0C09),
2788- LANG("English - Belize", "en_bz", 0x2809),
2789- LANG("English - Canada", "en_ca", 0x1009),
2790- LANG("English - Caribbean", "en_cb", 0x2409),
2791- LANG("English - Ireland", "en_ie", 0x1809),
2792- LANG("English - Jamaica", "en_jm", 0x2009),
2793- LANG("English - New Zealand", "en_nz", 0x1409),
2794- LANG("English - Phillippines", "en_ph", 0x3409),
2795- LANG("English - Southern Africa", "en_za", 0x1C09),
2796- LANG("English - Trinidad", "en_tt", 0x2C09),
2797- LANG("English - Great Britain", "en_gb", 0x0809),
2798- LANG("English - United States", "en_us", 0x0409),
2799- LANG("Estonian", "et", 0x0425),
2800- LANG("Farsi", "fa", 0x0429),
2801- LANG("Finnish", "fi", 0x040B),
2802- LANG("Faroese", "fo", 0x0438),
2803- LANG("French - France", "fr_fr", 0x040C),
2804- LANG("French - Belgium", "fr_be", 0x080C),
2805- LANG("French - Canada", "fr_ca", 0x0C0C),
2806- LANG("French - Luxembourg", "fr_lu", 0x140C),
2807- LANG("French - Switzerland", "fr_ch", 0x100C),
2808- LANG("Gaelic - Ireland", "gd_ie", 0x083C),
2809- LANG("Gaelic - Scotland", "gd", 0x043C),
2810- LANG("German - Germany", "de_de", 0x0407),
2811- LANG("German - Austria", "de_at", 0x0C07),
2812- LANG("German - Liechtenstein", "de_li", 0x1407),
2813- LANG("German - Luxembourg", "de_lu", 0x1007),
2814- LANG("German - Switzerland", "de_ch", 0x0807),
2815- LANG("Greek", "el", 0x0408),
2816- LANG("Hebrew", "he", 0x040D),
2817- LANG("Hindi", "hi", 0x0439),
2818- LANG("Hungarian", "hu", 0x040E),
2819- LANG("Icelandic", "is", 0x040F),
2820- LANG("Indonesian", "id", 0x0421),
2821- LANG("Italian - Italy", "it_it", 0x0410),
2822- LANG("Italian - Switzerland", "it_ch", 0x0810),
2823- LANG("Japanese", "ja", 0x0411),
2824- LANG("Korean", "ko", 0x0412),
2825- LANG("Latvian", "lv", 0x0426),
2826- LANG("Lithuanian", "lt", 0x0427),
2827- LANG("F.Y.R.O. Macedonia", "mk", 0x042F),
2828- LANG("Malay - Malaysia", "ms_my", 0x043E),
2829- LANG("Malay – Brunei", "ms_bn", 0x083E),
2830- LANG("Maltese", "mt", 0x043A),
2831- LANG("Marathi", "mr", 0x044E),
2832- LANG("Norwegian - Bokml", "no_no", 0x0414),
2833- LANG("Norwegian - Nynorsk", "no_no", 0x0814),
2834- LANG("Polish", "pl", 0x0415),
2835- LANG("Portuguese - Portugal", "pt_pt", 0x0816),
2836- LANG("Portuguese - Brazil", "pt_br", 0x0416),
2837- LANG("Raeto-Romance", "rm", 0x0417),
2838- LANG("Romanian - Romania", "ro", 0x0418),
2839- LANG("Romanian - Republic of Moldova", "ro_mo", 0x0818),
2840- LANG("Russian", "ru", 0x0419),
2841- LANG("Russian - Republic of Moldova", "ru_mo", 0x0819),
2842- LANG("Sanskrit", "sa", 0x044F),
2843- LANG("Serbian - Cyrillic", "sr_sp", 0x0C1A),
2844- LANG("Serbian - Latin", "sr_sp", 0x081A),
2845- LANG("Setsuana", "tn", 0x0432),
2846- LANG("Slovenian", "sl", 0x0424),
2847- LANG("Slovak", "sk", 0x041B),
2848- LANG("Sorbian", "sb", 0x042E),
2849- LANG("Spanish - Spain (Traditional)", "es_es", 0x040A),
2850- LANG("Spanish - Argentina", "es_ar", 0x2C0A),
2851- LANG("Spanish - Bolivia", "es_bo", 0x400A),
2852- LANG("Spanish - Chile", "es_cl", 0x340A),
2853- LANG("Spanish - Colombia", "es_co", 0x240A),
2854- LANG("Spanish - Costa Rica", "es_cr", 0x140A),
2855- LANG("Spanish - Dominican Republic", "es_do", 0x1C0A),
2856- LANG("Spanish - Ecuador", "es_ec", 0x300A),
2857- LANG("Spanish - Guatemala", "es_gt", 0x100A),
2858- LANG("Spanish - Honduras", "es_hn", 0x480A),
2859- LANG("Spanish - Mexico", "es_mx", 0x080A),
2860- LANG("Spanish - Nicaragua", "es_ni", 0x4C0A),
2861- LANG("Spanish - Panama", "es_pa", 0x180A),
2862- LANG("Spanish - Peru", "es_pe", 0x280A),
2863- LANG("Spanish - Puerto Rico", "es_pr", 0x500A),
2864- LANG("Spanish - Paraguay", "es_py", 0x3C0A),
2865- LANG("Spanish - El Salvador", "es_sv", 0x440A),
2866- LANG("Spanish - Uruguay", "es_uy", 0x380A),
2867- LANG("Spanish - Venezuela", "es_ve", 0x200A),
2868- LANG("Southern Sotho", "st", 0x0430),
2869- LANG("Swahili", "sw", 0x0441),
2870- LANG("Swedish - Sweden", "sv_se", 0x041D),
2871- LANG("Swedish - Finland", "sv_fi", 0x081D),
2872- LANG("Tamil", "ta", 0x0449),
2873- LANG("Tatar", "tt", 0X0444),
2874- LANG("Thai", "th", 0x041E),
2875- LANG("Turkish", "tr", 0x041F),
2876- LANG("Tsonga", "ts", 0x0431),
2877- LANG("Ukrainian", "uk", 0x0422),
2878- LANG("Urdu", "ur", 0x0420),
2879- LANG("Uzbek - Cyrillic", "uz_uz", 0x0843),
2880- LANG("Uzbek – Latin", "uz_uz", 0x0443),
2881- LANG("Vietnamese", "vi", 0x042A),
2882- LANG("Xhosa", "xh", 0x0434),
2883- LANG("Yiddish", "yi", 0x043D),
2884- LANG("Zulu", "zu", 0x0435),
2885- LANG(NULL, NULL, 0x0),
2886-};
2887-
2888-uint16_t get_usb_code_for_current_locale(void)
2889-{
2890- char *locale;
2891- char search_string[64];
2892- char *ptr;
2893-
2894- /* Get the current locale. */
2895- locale = setlocale(0, NULL);
2896- if (!locale)
2897- return 0x0;
2898-
2899- /* Make a copy of the current locale string. */
2900- strncpy(search_string, locale, sizeof(search_string));
2901- search_string[sizeof(search_string)-1] = '\0';
2902-
2903- /* Chop off the encoding part, and make it lower case. */
2904- ptr = search_string;
2905- while (*ptr) {
2906- *ptr = tolower(*ptr);
2907- if (*ptr == '.') {
2908- *ptr = '\0';
2909- break;
2910- }
2911- ptr++;
2912- }
2913-
2914- /* Find the entry which matches the string code of our locale. */
2915- struct lang_map_entry *lang = lang_map;
2916- while (lang->string_code) {
2917- if (!strcmp(lang->string_code, search_string)) {
2918- return lang->usb_code;
2919- }
2920- lang++;
2921- }
2922-
2923- /* There was no match. Find with just the language only. */
2924- /* Chop off the variant. Chop it off at the '_'. */
2925- ptr = search_string;
2926- while (*ptr) {
2927- *ptr = tolower(*ptr);
2928- if (*ptr == '_') {
2929- *ptr = '\0';
2930- break;
2931- }
2932- ptr++;
2933- }
2934-
2935-#if 0 // TODO: Do we need this?
2936- /* Find the entry which matches the string code of our language. */
2937- lang = lang_map;
2938- while (lang->string_code) {
2939- if (!strcmp(lang->string_code, search_string)) {
2940- return lang->usb_code;
2941- }
2942- lang++;
2943- }
2944-#endif
2945-
2946- /* Found nothing. */
2947- return 0x0;
2948-}
2949-
2950-#ifdef __cplusplus
2951-}
2952-#endif
2953
2954=== removed file 'mixxx/lib/hidapi-0.7.0/linux/hid.c'
2955--- mixxx/lib/hidapi-0.7.0/linux/hid.c 2012-01-28 09:23:48 +0000
2956+++ mixxx/lib/hidapi-0.7.0/linux/hid.c 1970-01-01 00:00:00 +0000
2957@@ -1,595 +0,0 @@
2958-/*******************************************************
2959- HIDAPI - Multi-Platform library for
2960- communication with HID devices.
2961-
2962- Alan Ott
2963- Signal 11 Software
2964-
2965- 8/22/2009
2966- Linux Version - 6/2/2009
2967-
2968- Copyright 2009, All Rights Reserved.
2969-
2970- At the discretion of the user of this library,
2971- this software may be licensed under the terms of the
2972- GNU Public License v3, a BSD-Style license, or the
2973- original HIDAPI license as outlined in the LICENSE.txt,
2974- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
2975- files located at the root of the source distribution.
2976- These files may also be found in the public source
2977- code repository located at:
2978- http://github.com/signal11/hidapi .
2979-********************************************************/
2980-
2981-/* C */
2982-#include <stdio.h>
2983-#include <string.h>
2984-#include <stdlib.h>
2985-#include <locale.h>
2986-#include <errno.h>
2987-
2988-/* Unix */
2989-#include <unistd.h>
2990-#include <sys/types.h>
2991-#include <sys/stat.h>
2992-#include <sys/ioctl.h>
2993-#include <sys/utsname.h>
2994-#include <fcntl.h>
2995-#include <poll.h>
2996-
2997-/* Linux */
2998-#include <linux/hidraw.h>
2999-#include <linux/version.h>
3000-#include <libudev.h>
3001-
3002-#include "hidapi.h"
3003-
3004-/* Definitions from linux/hidraw.h. Since these are new, some distros
3005- may not have header files which contain them. */
3006-#ifndef HIDIOCSFEATURE
3007-#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
3008-#endif
3009-#ifndef HIDIOCGFEATURE
3010-#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
3011-#endif
3012-
3013-struct hid_device_ {
3014- int device_handle;
3015- int blocking;
3016- int uses_numbered_reports;
3017-};
3018-
3019-
3020-static __u32 kernel_version = 0;
3021-
3022-hid_device *new_hid_device()
3023-{
3024- hid_device *dev = calloc(1, sizeof(hid_device));
3025- dev->device_handle = -1;
3026- dev->blocking = 1;
3027- dev->uses_numbered_reports = 0;
3028-
3029- return dev;
3030-}
3031-
3032-static void register_error(hid_device *device, const char *op)
3033-{
3034-
3035-}
3036-
3037-/* Get an attribute value from a udev_device and return it as a whar_t
3038- string. The returned string must be freed with free() when done.*/
3039-static wchar_t *copy_udev_string(struct udev_device *dev, const char *udev_name)
3040-{
3041- const char *str;
3042- wchar_t *ret = NULL;
3043- str = udev_device_get_sysattr_value(dev, udev_name);
3044- if (str) {
3045- /* Convert the string from UTF-8 to wchar_t */
3046- size_t wlen = mbstowcs(NULL, str, 0);
3047- ret = calloc(wlen+1, sizeof(wchar_t));
3048- mbstowcs(ret, str, wlen+1);
3049- ret[wlen] = 0x0000;
3050- }
3051-
3052- return ret;
3053-}
3054-
3055-/* uses_numbered_reports() returns 1 if report_descriptor describes a device
3056- which contains numbered reports. */
3057-static int uses_numbered_reports(__u8 *report_descriptor, __u32 size) {
3058- int i = 0;
3059- int size_code;
3060- int data_len, key_size;
3061-
3062- while (i < size) {
3063- int key = report_descriptor[i];
3064-
3065- /* Check for the Report ID key */
3066- if (key == 0x85/*Report ID*/) {
3067- /* This device has a Report ID, which means it uses
3068- numbered reports. */
3069- return 1;
3070- }
3071-
3072- //printf("key: %02hhx\n", key);
3073-
3074- if ((key & 0xf0) == 0xf0) {
3075- /* This is a Long Item. The next byte contains the
3076- length of the data section (value) for this key.
3077- See the HID specification, version 1.11, section
3078- 6.2.2.3, titled "Long Items." */
3079- if (i+1 < size)
3080- data_len = report_descriptor[i+1];
3081- else
3082- data_len = 0; /* malformed report */
3083- key_size = 3;
3084- }
3085- else {
3086- /* This is a Short Item. The bottom two bits of the
3087- key contain the size code for the data section
3088- (value) for this key. Refer to the HID
3089- specification, version 1.11, section 6.2.2.2,
3090- titled "Short Items." */
3091- size_code = key & 0x3;
3092- switch (size_code) {
3093- case 0:
3094- case 1:
3095- case 2:
3096- data_len = size_code;
3097- break;
3098- case 3:
3099- data_len = 4;
3100- break;
3101- default:
3102- /* Can't ever happen since size_code is & 0x3 */
3103- data_len = 0;
3104- break;
3105- };
3106- key_size = 1;
3107- }
3108-
3109- /* Skip over this key and it's associated data */
3110- i += data_len + key_size;
3111- }
3112-
3113- /* Didn't find a Report ID key. Device doesn't use numbered reports. */
3114- return 0;
3115-}
3116-
3117-static int get_device_string(hid_device *dev, const char *key, wchar_t *string, size_t maxlen)
3118-{
3119- struct udev *udev;
3120- struct udev_device *udev_dev, *parent;
3121- struct stat s;
3122- int ret = -1;
3123-
3124- setlocale(LC_ALL,"");
3125-
3126- /* Create the udev object */
3127- udev = udev_new();
3128- if (!udev) {
3129- printf("Can't create udev\n");
3130- return -1;
3131- }
3132-
3133- /* Get the dev_t (major/minor numbers) from the file handle. */
3134- fstat(dev->device_handle, &s);
3135- /* Open a udev device from the dev_t. 'c' means character device. */
3136- udev_dev = udev_device_new_from_devnum(udev, 'c', s.st_rdev);
3137- if (udev_dev) {
3138- const char *str;
3139- /* Find the parent USB Device */
3140- parent = udev_device_get_parent_with_subsystem_devtype(
3141- udev_dev,
3142- "usb",
3143- "usb_device");
3144- if (parent) {
3145- str = udev_device_get_sysattr_value(parent, key);
3146- if (str) {
3147- /* Convert the string from UTF-8 to wchar_t */
3148- ret = mbstowcs(string, str, maxlen);
3149- goto end;
3150- }
3151- }
3152- }
3153-
3154-end:
3155- udev_device_unref(udev_dev);
3156- // parent doesn't need to be (and can't be) unref'd.
3157- // I'm not sure why, but it'll throw double-free() errors.
3158- udev_unref(udev);
3159-
3160- return ret;
3161-}
3162-
3163-int HID_API_EXPORT hid_init(void)
3164-{
3165- /* Nothing to do for this in the Linux/hidraw implementation. */
3166- return 0;
3167-}
3168-
3169-int HID_API_EXPORT hid_exit(void)
3170-{
3171- /* Nothing to do for this in the Linux/hidraw implementation. */
3172- return 0;
3173-}
3174-
3175-struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id)
3176-{
3177- struct udev *udev;
3178- struct udev_enumerate *enumerate;
3179- struct udev_list_entry *devices, *dev_list_entry;
3180-
3181- struct hid_device_info *root = NULL; // return object
3182- struct hid_device_info *cur_dev = NULL;
3183-
3184- setlocale(LC_ALL,"");
3185-
3186- /* Create the udev object */
3187- udev = udev_new();
3188- if (!udev) {
3189- printf("Can't create udev\n");
3190- return NULL;
3191- }
3192-
3193- /* Create a list of the devices in the 'hidraw' subsystem. */
3194- enumerate = udev_enumerate_new(udev);
3195- udev_enumerate_add_match_subsystem(enumerate, "hidraw");
3196- udev_enumerate_scan_devices(enumerate);
3197- devices = udev_enumerate_get_list_entry(enumerate);
3198- /* For each item, see if it matches the vid/pid, and if so
3199- create a udev_device record for it */
3200- udev_list_entry_foreach(dev_list_entry, devices) {
3201- const char *sysfs_path;
3202- const char *dev_path;
3203- const char *str;
3204- struct udev_device *hid_dev; // The device's HID udev node.
3205- struct udev_device *dev; // The actual hardware device.
3206- struct udev_device *intf_dev; // The device's interface (in the USB sense).
3207- unsigned short dev_vid;
3208- unsigned short dev_pid;
3209-
3210- /* Get the filename of the /sys entry for the device
3211- and create a udev_device object (dev) representing it */
3212- sysfs_path = udev_list_entry_get_name(dev_list_entry);
3213- hid_dev = udev_device_new_from_syspath(udev, sysfs_path);
3214- dev_path = udev_device_get_devnode(hid_dev);
3215-
3216- /* The device pointed to by hid_dev contains information about
3217- the hidraw device. In order to get information about the
3218- USB device, get the parent device with the
3219- subsystem/devtype pair of "usb"/"usb_device". This will
3220- be several levels up the tree, but the function will find
3221- it.*/
3222- dev = udev_device_get_parent_with_subsystem_devtype(
3223- hid_dev,
3224- "usb",
3225- "usb_device");
3226- if (!dev) {
3227- /* Unable to find parent usb device. */
3228- goto next;
3229- }
3230-
3231- /* Get the VID/PID of the device */
3232- str = udev_device_get_sysattr_value(dev,"idVendor");
3233- dev_vid = (str)? strtol(str, NULL, 16): 0x0;
3234- str = udev_device_get_sysattr_value(dev, "idProduct");
3235- dev_pid = (str)? strtol(str, NULL, 16): 0x0;
3236-
3237- /* Check the VID/PID against the arguments */
3238- if ((vendor_id == 0x0 && product_id == 0x0) ||
3239- (vendor_id == dev_vid && product_id == dev_pid)) {
3240- struct hid_device_info *tmp;
3241- size_t len;
3242-
3243- /* VID/PID match. Create the record. */
3244- tmp = malloc(sizeof(struct hid_device_info));
3245- if (cur_dev) {
3246- cur_dev->next = tmp;
3247- }
3248- else {
3249- root = tmp;
3250- }
3251- cur_dev = tmp;
3252-
3253- /* Fill out the record */
3254- cur_dev->next = NULL;
3255- str = dev_path;
3256- if (str) {
3257- len = strlen(str);
3258- cur_dev->path = calloc(len+1, sizeof(char));
3259- strncpy(cur_dev->path, str, len+1);
3260- cur_dev->path[len] = '\0';
3261- }
3262- else
3263- cur_dev->path = NULL;
3264-
3265- /* Serial Number */
3266- cur_dev->serial_number
3267- = copy_udev_string(dev, "serial");
3268-
3269- /* Manufacturer and Product strings */
3270- cur_dev->manufacturer_string
3271- = copy_udev_string(dev, "manufacturer");
3272- cur_dev->product_string
3273- = copy_udev_string(dev, "product");
3274-
3275- /* VID/PID */
3276- cur_dev->vendor_id = dev_vid;
3277- cur_dev->product_id = dev_pid;
3278-
3279- /* Release Number */
3280- str = udev_device_get_sysattr_value(dev, "bcdDevice");
3281- cur_dev->release_number = (str)? strtol(str, NULL, 16): 0x0;
3282-
3283- /* Interface Number */
3284- cur_dev->interface_number = -1;
3285- /* Get a handle to the interface's udev node. */
3286- intf_dev = udev_device_get_parent_with_subsystem_devtype(
3287- hid_dev,
3288- "usb",
3289- "usb_interface");
3290- if (intf_dev) {
3291- str = udev_device_get_sysattr_value(intf_dev, "bInterfaceNumber");
3292- cur_dev->interface_number = (str)? strtol(str, NULL, 16): -1;
3293- }
3294- }
3295- else
3296- goto next;
3297-
3298- next:
3299- udev_device_unref(hid_dev);
3300- /* dev and intf_dev don't need to be (and can't be)
3301- unref()d. It will cause a double-free() error. I'm not
3302- sure why. */
3303- }
3304- /* Free the enumerator and udev objects. */
3305- udev_enumerate_unref(enumerate);
3306- udev_unref(udev);
3307-
3308- return root;
3309-}
3310-
3311-void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs)
3312-{
3313- struct hid_device_info *d = devs;
3314- while (d) {
3315- struct hid_device_info *next = d->next;
3316- free(d->path);
3317- free(d->serial_number);
3318- free(d->manufacturer_string);
3319- free(d->product_string);
3320- free(d);
3321- d = next;
3322- }
3323-}
3324-
3325-hid_device * hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number)
3326-{
3327- struct hid_device_info *devs, *cur_dev;
3328- const char *path_to_open = NULL;
3329- hid_device *handle = NULL;
3330-
3331- devs = hid_enumerate(vendor_id, product_id);
3332- cur_dev = devs;
3333- while (cur_dev) {
3334- if (cur_dev->vendor_id == vendor_id &&
3335- cur_dev->product_id == product_id) {
3336- if (serial_number) {
3337- if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
3338- path_to_open = cur_dev->path;
3339- break;
3340- }
3341- }
3342- else {
3343- path_to_open = cur_dev->path;
3344- break;
3345- }
3346- }
3347- cur_dev = cur_dev->next;
3348- }
3349-
3350- if (path_to_open) {
3351- /* Open the device */
3352- handle = hid_open_path(path_to_open);
3353- }
3354-
3355- hid_free_enumeration(devs);
3356-
3357- return handle;
3358-}
3359-
3360-hid_device * HID_API_EXPORT hid_open_path(const char *path)
3361-{
3362- hid_device *dev = NULL;
3363-
3364- dev = new_hid_device();
3365-
3366- if (kernel_version == 0) {
3367- struct utsname name;
3368- int major, minor, release;
3369- int ret;
3370- uname(&name);
3371- ret = sscanf(name.release, "%d.%d.%d", &major, &minor, &release);
3372- if (ret == 3) {
3373- kernel_version = major << 16 | minor << 8 | release;
3374- //printf("Kernel Version: %d\n", kernel_version);
3375- }
3376- else {
3377- printf("Couldn't sscanf() version string %s\n", name.release);
3378- }
3379- }
3380-
3381- // OPEN HERE //
3382- dev->device_handle = open(path, O_RDWR);
3383-
3384- // If we have a good handle, return it.
3385- if (dev->device_handle > 0) {
3386-
3387- /* Get the report descriptor */
3388- int res, desc_size = 0;
3389- struct hidraw_report_descriptor rpt_desc;
3390-
3391- memset(&rpt_desc, 0x0, sizeof(rpt_desc));
3392-
3393- /* Get Report Descriptor Size */
3394- res = ioctl(dev->device_handle, HIDIOCGRDESCSIZE, &desc_size);
3395- if (res < 0)
3396- perror("HIDIOCGRDESCSIZE");
3397-
3398-
3399- /* Get Report Descriptor */
3400- rpt_desc.size = desc_size;
3401- res = ioctl(dev->device_handle, HIDIOCGRDESC, &rpt_desc);
3402- if (res < 0) {
3403- perror("HIDIOCGRDESC");
3404- } else {
3405- /* Determine if this device uses numbered reports. */
3406- dev->uses_numbered_reports =
3407- uses_numbered_reports(rpt_desc.value,
3408- rpt_desc.size);
3409- }
3410-
3411- return dev;
3412- }
3413- else {
3414- // Unable to open any devices.
3415- free(dev);
3416- return NULL;
3417- }
3418-}
3419-
3420-
3421-int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
3422-{
3423- int bytes_written;
3424-
3425- bytes_written = write(dev->device_handle, data, length);
3426-
3427- return bytes_written;
3428-}
3429-
3430-
3431-int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
3432-{
3433- int bytes_read;
3434-
3435- if (milliseconds != 0) {
3436- /* milliseconds is -1 or > 0. In both cases, we want to
3437- call poll() and wait for data to arrive. -1 means
3438- INFINITE. */
3439- int ret;
3440- struct pollfd fds;
3441-
3442- fds.fd = dev->device_handle;
3443- fds.events = POLLIN;
3444- fds.revents = 0;
3445- ret = poll(&fds, 1, milliseconds);
3446- if (ret == -1 || ret == 0)
3447- /* Error or timeout */
3448- return ret;
3449- }
3450-
3451- bytes_read = read(dev->device_handle, data, length);
3452- if (bytes_read < 0 && errno == EAGAIN)
3453- bytes_read = 0;
3454-
3455- if (bytes_read >= 0 &&
3456- kernel_version < KERNEL_VERSION(2,6,34) &&
3457- dev->uses_numbered_reports) {
3458- /* Work around a kernel bug. Chop off the first byte. */
3459- memmove(data, data+1, bytes_read);
3460- bytes_read--;
3461- }
3462-
3463- return bytes_read;
3464-}
3465-
3466-int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length)
3467-{
3468- return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0);
3469-}
3470-
3471-int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
3472-{
3473- int flags, res;
3474-
3475- flags = fcntl(dev->device_handle, F_GETFL, 0);
3476- if (flags >= 0) {
3477- if (nonblock)
3478- res = fcntl(dev->device_handle, F_SETFL, flags | O_NONBLOCK);
3479- else
3480- res = fcntl(dev->device_handle, F_SETFL, flags & ~O_NONBLOCK);
3481- }
3482- else
3483- return -1;
3484-
3485- if (res < 0) {
3486- return -1;
3487- }
3488- else {
3489- dev->blocking = !nonblock;
3490- return 0; /* Success */
3491- }
3492-}
3493-
3494-
3495-int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
3496-{
3497- int res;
3498-
3499- res = ioctl(dev->device_handle, HIDIOCSFEATURE(length), data);
3500- if (res < 0)
3501- perror("ioctl (SFEATURE)");
3502-
3503- return res;
3504-}
3505-
3506-int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
3507-{
3508- int res;
3509-
3510- res = ioctl(dev->device_handle, HIDIOCGFEATURE(length), data);
3511- if (res < 0)
3512- perror("ioctl (GFEATURE)");
3513-
3514-
3515- return res;
3516-}
3517-
3518-
3519-void HID_API_EXPORT hid_close(hid_device *dev)
3520-{
3521- if (!dev)
3522- return;
3523- close(dev->device_handle);
3524- free(dev);
3525-}
3526-
3527-
3528-int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
3529-{
3530- return get_device_string(dev, "manufacturer", string, maxlen);
3531-}
3532-
3533-int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
3534-{
3535- return get_device_string(dev, "product", string, maxlen);
3536-}
3537-
3538-int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
3539-{
3540- return get_device_string(dev, "serial", string, maxlen);
3541-}
3542-
3543-int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
3544-{
3545- return -1;
3546-}
3547-
3548-
3549-HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
3550-{
3551- return NULL;
3552-}
3553
3554=== removed directory 'mixxx/lib/hidapi-0.7.0/mac'
3555=== removed file 'mixxx/lib/hidapi-0.7.0/mac/.gitignore'
3556--- mixxx/lib/hidapi-0.7.0/mac/.gitignore 2012-01-28 09:23:48 +0000
3557+++ mixxx/lib/hidapi-0.7.0/mac/.gitignore 1970-01-01 00:00:00 +0000
3558@@ -1,13 +0,0 @@
3559-Debug
3560-Release
3561-*.exp
3562-*.ilk
3563-*.lib
3564-*.suo
3565-*.vcproj.*
3566-*.ncb
3567-*.suo
3568-*.dll
3569-*.pdb
3570-*.o
3571-hidtest
3572\ No newline at end of file
3573
3574=== removed file 'mixxx/lib/hidapi-0.7.0/mac/Makefile'
3575--- mixxx/lib/hidapi-0.7.0/mac/Makefile 2012-01-28 09:23:48 +0000
3576+++ mixxx/lib/hidapi-0.7.0/mac/Makefile 1970-01-01 00:00:00 +0000
3577@@ -1,32 +0,0 @@
3578-###########################################
3579-# Simple Makefile for HIDAPI test program
3580-#
3581-# Alan Ott
3582-# Signal 11 Software
3583-# 2010-07-03
3584-###########################################
3585-
3586-all: hidtest
3587-
3588-CC=gcc
3589-CXX=g++
3590-COBJS=hid.o
3591-CPPOBJS=../hidtest/hidtest.o
3592-OBJS=$(COBJS) $(CPPOBJS)
3593-CFLAGS+=-I../hidapi -Wall -g -c
3594-LIBS=-framework IOKit -framework CoreFoundation
3595-
3596-
3597-hidtest: $(OBJS)
3598- g++ -Wall -g $^ $(LIBS) -o hidtest
3599-
3600-$(COBJS): %.o: %.c
3601- $(CC) $(CFLAGS) $< -o $@
3602-
3603-$(CPPOBJS): %.o: %.cpp
3604- $(CXX) $(CFLAGS) $< -o $@
3605-
3606-clean:
3607- rm -f *.o hidtest $(CPPOBJS)
3608-
3609-.PHONY: clean
3610
3611=== removed file 'mixxx/lib/hidapi-0.7.0/mac/hid.c'
3612--- mixxx/lib/hidapi-0.7.0/mac/hid.c 2012-01-28 09:23:48 +0000
3613+++ mixxx/lib/hidapi-0.7.0/mac/hid.c 1970-01-01 00:00:00 +0000
3614@@ -1,1122 +0,0 @@
3615-/*******************************************************
3616- HIDAPI - Multi-Platform library for
3617- communication with HID devices.
3618-
3619- Alan Ott
3620- Signal 11 Software
3621-
3622- 2010-07-03
3623-
3624- Copyright 2010, All Rights Reserved.
3625-
3626- At the discretion of the user of this library,
3627- this software may be licensed under the terms of the
3628- GNU Public License v3, a BSD-Style license, or the
3629- original HIDAPI license as outlined in the LICENSE.txt,
3630- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
3631- files located at the root of the source distribution.
3632- These files may also be found in the public source
3633- code repository located at:
3634- http://github.com/signal11/hidapi .
3635-********************************************************/
3636-
3637-/* See Apple Technical Note TN2187 for details on IOHidManager. */
3638-
3639-#include <IOKit/hid/IOHIDManager.h>
3640-#include <IOKit/hid/IOHIDKeys.h>
3641-#include <CoreFoundation/CoreFoundation.h>
3642-#include <wchar.h>
3643-#include <locale.h>
3644-#include <pthread.h>
3645-#include <sys/time.h>
3646-#include <unistd.h>
3647-
3648-#include "hidapi.h"
3649-
3650-/* Barrier implementation because Mac OSX doesn't have pthread_barrier.
3651- It also doesn't have clock_gettime(). So much for POSIX and SUSv2.
3652- This implementation came from Brent Priddy and was posted on
3653- StackOverflow. It is used with his permission. */
3654-typedef int pthread_barrierattr_t;
3655-typedef struct pthread_barrier {
3656- pthread_mutex_t mutex;
3657- pthread_cond_t cond;
3658- int count;
3659- int trip_count;
3660-} pthread_barrier_t;
3661-
3662-static int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)
3663-{
3664- if(count == 0) {
3665- errno = EINVAL;
3666- return -1;
3667- }
3668-
3669- if(pthread_mutex_init(&barrier->mutex, 0) < 0) {
3670- return -1;
3671- }
3672- if(pthread_cond_init(&barrier->cond, 0) < 0) {
3673- pthread_mutex_destroy(&barrier->mutex);
3674- return -1;
3675- }
3676- barrier->trip_count = count;
3677- barrier->count = 0;
3678-
3679- return 0;
3680-}
3681-
3682-static int pthread_barrier_destroy(pthread_barrier_t *barrier)
3683-{
3684- pthread_cond_destroy(&barrier->cond);
3685- pthread_mutex_destroy(&barrier->mutex);
3686- return 0;
3687-}
3688-
3689-static int pthread_barrier_wait(pthread_barrier_t *barrier)
3690-{
3691- pthread_mutex_lock(&barrier->mutex);
3692- ++(barrier->count);
3693- if(barrier->count >= barrier->trip_count)
3694- {
3695- barrier->count = 0;
3696- pthread_cond_broadcast(&barrier->cond);
3697- pthread_mutex_unlock(&barrier->mutex);
3698- return 1;
3699- }
3700- else
3701- {
3702- pthread_cond_wait(&barrier->cond, &(barrier->mutex));
3703- pthread_mutex_unlock(&barrier->mutex);
3704- return 0;
3705- }
3706-}
3707-
3708-static int return_data(hid_device *dev, unsigned char *data, size_t length);
3709-
3710-/* Linked List of input reports received from the device. */
3711-struct input_report {
3712- uint8_t *data;
3713- size_t len;
3714- struct input_report *next;
3715-};
3716-
3717-struct hid_device_ {
3718- IOHIDDeviceRef device_handle;
3719- int blocking;
3720- int uses_numbered_reports;
3721- int disconnected;
3722- CFStringRef run_loop_mode;
3723- CFRunLoopRef run_loop;
3724- CFRunLoopSourceRef source;
3725- uint8_t *input_report_buf;
3726- CFIndex max_input_report_len;
3727- struct input_report *input_reports;
3728-
3729- pthread_t thread;
3730- pthread_mutex_t mutex; /* Protects input_reports */
3731- pthread_cond_t condition;
3732- pthread_barrier_t barrier; /* Ensures correct startup sequence */
3733- pthread_barrier_t shutdown_barrier; /* Ensures correct shutdown sequence */
3734- int shutdown_thread;
3735-
3736- hid_device *next;
3737-};
3738-
3739-/* Static list of all the devices open. This way when a device gets
3740- disconnected, its hid_device structure can be marked as disconnected
3741- from hid_device_removal_callback(). */
3742-static hid_device *device_list = NULL;
3743-static pthread_mutex_t device_list_mutex = PTHREAD_MUTEX_INITIALIZER;
3744-
3745-static hid_device *new_hid_device(void)
3746-{
3747- hid_device *dev = calloc(1, sizeof(hid_device));
3748- dev->device_handle = NULL;
3749- dev->blocking = 1;
3750- dev->uses_numbered_reports = 0;
3751- dev->disconnected = 0;
3752- dev->run_loop_mode = NULL;
3753- dev->run_loop = NULL;
3754- dev->source = NULL;
3755- dev->input_report_buf = NULL;
3756- dev->input_reports = NULL;
3757- dev->shutdown_thread = 0;
3758- dev->next = NULL;
3759-
3760- /* Thread objects */
3761- pthread_mutex_init(&dev->mutex, NULL);
3762- pthread_cond_init(&dev->condition, NULL);
3763- pthread_barrier_init(&dev->barrier, NULL, 2);
3764- pthread_barrier_init(&dev->shutdown_barrier, NULL, 2);
3765-
3766- /* Add the new record to the device_list. */
3767- pthread_mutex_lock(&device_list_mutex);
3768- if (!device_list)
3769- device_list = dev;
3770- else {
3771- hid_device *d = device_list;
3772- while (d) {
3773- if (!d->next) {
3774- d->next = dev;
3775- break;
3776- }
3777- d = d->next;
3778- }
3779- }
3780- pthread_mutex_unlock(&device_list_mutex);
3781-
3782- return dev;
3783-}
3784-
3785-static void free_hid_device(hid_device *dev)
3786-{
3787- if (!dev)
3788- return;
3789-
3790- /* Delete any input reports still left over. */
3791- struct input_report *rpt = dev->input_reports;
3792- while (rpt) {
3793- struct input_report *next = rpt->next;
3794- free(rpt->data);
3795- free(rpt);
3796- rpt = next;
3797- }
3798-
3799- /* Free the string and the report buffer. The check for NULL
3800- is necessary here as CFRelease() doesn't handle NULL like
3801- free() and others do. */
3802- if (dev->run_loop_mode)
3803- CFRelease(dev->run_loop_mode);
3804- if (dev->source)
3805- CFRelease(dev->source);
3806- free(dev->input_report_buf);
3807-
3808- /* Clean up the thread objects */
3809- pthread_barrier_destroy(&dev->shutdown_barrier);
3810- pthread_barrier_destroy(&dev->barrier);
3811- pthread_cond_destroy(&dev->condition);
3812- pthread_mutex_destroy(&dev->mutex);
3813-
3814- /* Remove it from the device list. */
3815- pthread_mutex_lock(&device_list_mutex);
3816- hid_device *d = device_list;
3817- if (d == dev) {
3818- device_list = d->next;
3819- }
3820- else {
3821- while (d) {
3822- if (d->next == dev) {
3823- d->next = d->next->next;
3824- break;
3825- }
3826-
3827- d = d->next;
3828- }
3829- }
3830- pthread_mutex_unlock(&device_list_mutex);
3831-
3832- /* Free the structure itself. */
3833- free(dev);
3834-}
3835-
3836-static IOHIDManagerRef hid_mgr = 0x0;
3837-
3838-
3839-#if 0
3840-static void register_error(hid_device *device, const char *op)
3841-{
3842-
3843-}
3844-#endif
3845-
3846-
3847-static int32_t get_int_property(IOHIDDeviceRef device, CFStringRef key)
3848-{
3849- CFTypeRef ref;
3850- int32_t value;
3851-
3852- ref = IOHIDDeviceGetProperty(device, key);
3853- if (ref) {
3854- if (CFGetTypeID(ref) == CFNumberGetTypeID()) {
3855- CFNumberGetValue((CFNumberRef) ref, kCFNumberSInt32Type, &value);
3856- return value;
3857- }
3858- }
3859- return 0;
3860-}
3861-
3862-static unsigned short get_vendor_id(IOHIDDeviceRef device)
3863-{
3864- return get_int_property(device, CFSTR(kIOHIDVendorIDKey));
3865-}
3866-
3867-static unsigned short get_product_id(IOHIDDeviceRef device)
3868-{
3869- return get_int_property(device, CFSTR(kIOHIDProductIDKey));
3870-}
3871-
3872-
3873-static int32_t get_max_report_length(IOHIDDeviceRef device)
3874-{
3875- return get_int_property(device, CFSTR(kIOHIDMaxInputReportSizeKey));
3876-}
3877-
3878-static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t *buf, size_t len)
3879-{
3880- CFStringRef str = IOHIDDeviceGetProperty(device, prop);
3881-
3882- buf[0] = 0x0000;
3883-
3884- if (str) {
3885- CFRange range;
3886- range.location = 0;
3887- range.length = len;
3888- CFIndex used_buf_len;
3889- CFStringGetBytes(str,
3890- range,
3891- kCFStringEncodingUTF32LE,
3892- (char)'?',
3893- FALSE,
3894- (UInt8*)buf,
3895- len,
3896- &used_buf_len);
3897- buf[len-1] = 0x00000000;
3898- return used_buf_len;
3899- }
3900- else
3901- return 0;
3902-
3903-}
3904-
3905-static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, char *buf, size_t len)
3906-{
3907- CFStringRef str = IOHIDDeviceGetProperty(device, prop);
3908-
3909- buf[0] = 0x0000;
3910-
3911- if (str) {
3912- CFRange range;
3913- range.location = 0;
3914- range.length = len;
3915- CFIndex used_buf_len;
3916- CFStringGetBytes(str,
3917- range,
3918- kCFStringEncodingUTF8,
3919- (char)'?',
3920- FALSE,
3921- (UInt8*)buf,
3922- len,
3923- &used_buf_len);
3924- buf[len-1] = 0x00000000;
3925- return used_buf_len;
3926- }
3927- else
3928- return 0;
3929-
3930-}
3931-
3932-
3933-static int get_serial_number(IOHIDDeviceRef device, wchar_t *buf, size_t len)
3934-{
3935- return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len);
3936-}
3937-
3938-static int get_manufacturer_string(IOHIDDeviceRef device, wchar_t *buf, size_t len)
3939-{
3940- return get_string_property(device, CFSTR(kIOHIDManufacturerKey), buf, len);
3941-}
3942-
3943-static int get_product_string(IOHIDDeviceRef device, wchar_t *buf, size_t len)
3944-{
3945- return get_string_property(device, CFSTR(kIOHIDProductKey), buf, len);
3946-}
3947-
3948-
3949-/* Implementation of wcsdup() for Mac. */
3950-static wchar_t *dup_wcs(const wchar_t *s)
3951-{
3952- size_t len = wcslen(s);
3953- wchar_t *ret = malloc((len+1)*sizeof(wchar_t));
3954- wcscpy(ret, s);
3955-
3956- return ret;
3957-}
3958-
3959-
3960-static int make_path(IOHIDDeviceRef device, char *buf, size_t len)
3961-{
3962- int res;
3963- unsigned short vid, pid;
3964- char transport[32];
3965-
3966- buf[0] = '\0';
3967-
3968- res = get_string_property_utf8(
3969- device, CFSTR(kIOHIDTransportKey),
3970- transport, sizeof(transport));
3971-
3972- if (!res)
3973- return -1;
3974-
3975- vid = get_vendor_id(device);
3976- pid = get_product_id(device);
3977-
3978- res = snprintf(buf, len, "%s_%04hx_%04hx_%p",
3979- transport, vid, pid, device);
3980-
3981-
3982- buf[len-1] = '\0';
3983- return res+1;
3984-}
3985-
3986-static int init_hid_manager(void)
3987-{
3988- IOReturn res;
3989-
3990- /* Initialize all the HID Manager Objects */
3991- hid_mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
3992- IOHIDManagerSetDeviceMatching(hid_mgr, NULL);
3993- IOHIDManagerScheduleWithRunLoop(hid_mgr, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
3994- res = IOHIDManagerOpen(hid_mgr, kIOHIDOptionsTypeNone);
3995- return (res == kIOReturnSuccess)? 0: -1;
3996-}
3997-
3998-int HID_API_EXPORT hid_init(void)
3999-{
4000- if (!hid_mgr) {
4001- if (init_hid_manager() < 0) {
4002- hid_exit();
4003- return -1;
4004- }
4005- }
4006- return 0;
4007-}
4008-
4009-int HID_API_EXPORT hid_exit(void)
4010-{
4011- if (hid_mgr) {
4012- /* Close the HID manager. */
4013- IOHIDManagerClose(hid_mgr, kIOHIDOptionsTypeNone);
4014- CFRelease(hid_mgr);
4015- hid_mgr = NULL;
4016- }
4017-
4018- return 0;
4019-}
4020-
4021-struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id)
4022-{
4023- struct hid_device_info *root = NULL; // return object
4024- struct hid_device_info *cur_dev = NULL;
4025- CFIndex num_devices;
4026- int i;
4027-
4028- setlocale(LC_ALL,"");
4029-
4030- /* Set up the HID Manager if it hasn't been done */
4031- hid_init();
4032-
4033- /* Get a list of the Devices */
4034- CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr);
4035-
4036- /* Convert the list into a C array so we can iterate easily. */
4037- num_devices = CFSetGetCount(device_set);
4038- IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef));
4039- CFSetGetValues(device_set, (const void **) device_array);
4040-
4041- /* Iterate over each device, making an entry for it. */
4042- for (i = 0; i < num_devices; i++) {
4043- unsigned short dev_vid;
4044- unsigned short dev_pid;
4045- #define BUF_LEN 256
4046- wchar_t buf[BUF_LEN];
4047- char cbuf[BUF_LEN];
4048-
4049- IOHIDDeviceRef dev = device_array[i];
4050-
4051- if (!dev) {
4052- continue;
4053- }
4054- dev_vid = get_vendor_id(dev);
4055- dev_pid = get_product_id(dev);
4056-
4057- /* Check the VID/PID against the arguments */
4058- if ((vendor_id == 0x0 && product_id == 0x0) ||
4059- (vendor_id == dev_vid && product_id == dev_pid)) {
4060- struct hid_device_info *tmp;
4061- size_t len;
4062-
4063- /* VID/PID match. Create the record. */
4064- tmp = malloc(sizeof(struct hid_device_info));
4065- if (cur_dev) {
4066- cur_dev->next = tmp;
4067- }
4068- else {
4069- root = tmp;
4070- }
4071- cur_dev = tmp;
4072-
4073- // Get the Usage Page and Usage for this device.
4074- cur_dev->usage_page = get_int_property(dev, CFSTR(kIOHIDPrimaryUsagePageKey));
4075- cur_dev->usage = get_int_property(dev, CFSTR(kIOHIDPrimaryUsageKey));
4076-
4077- /* Fill out the record */
4078- cur_dev->next = NULL;
4079- len = make_path(dev, cbuf, sizeof(cbuf));
4080- cur_dev->path = strdup(cbuf);
4081-
4082- /* Serial Number */
4083- get_serial_number(dev, buf, BUF_LEN);
4084- cur_dev->serial_number = dup_wcs(buf);
4085-
4086- /* Manufacturer and Product strings */
4087- get_manufacturer_string(dev, buf, BUF_LEN);
4088- cur_dev->manufacturer_string = dup_wcs(buf);
4089- get_product_string(dev, buf, BUF_LEN);
4090- cur_dev->product_string = dup_wcs(buf);
4091-
4092- /* VID/PID */
4093- cur_dev->vendor_id = dev_vid;
4094- cur_dev->product_id = dev_pid;
4095-
4096- /* Release Number */
4097- cur_dev->release_number = get_int_property(dev, CFSTR(kIOHIDVersionNumberKey));
4098-
4099- /* Interface Number (Unsupported on Mac)*/
4100- cur_dev->interface_number = -1;
4101- }
4102- }
4103-
4104- free(device_array);
4105- CFRelease(device_set);
4106-
4107- return root;
4108-}
4109-
4110-void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs)
4111-{
4112- /* This function is identical to the Linux version. Platform independent. */
4113- struct hid_device_info *d = devs;
4114- while (d) {
4115- struct hid_device_info *next = d->next;
4116- free(d->path);
4117- free(d->serial_number);
4118- free(d->manufacturer_string);
4119- free(d->product_string);
4120- free(d);
4121- d = next;
4122- }
4123-}
4124-
4125-hid_device * HID_API_EXPORT hid_open(unsigned short vendor_id, unsigned short product_id, wchar_t *serial_number)
4126-{
4127- /* This function is identical to the Linux version. Platform independent. */
4128- struct hid_device_info *devs, *cur_dev;
4129- const char *path_to_open = NULL;
4130- hid_device * handle = NULL;
4131-
4132- devs = hid_enumerate(vendor_id, product_id);
4133- cur_dev = devs;
4134- while (cur_dev) {
4135- if (cur_dev->vendor_id == vendor_id &&
4136- cur_dev->product_id == product_id) {
4137- if (serial_number) {
4138- if (wcscmp(serial_number, cur_dev->serial_number) == 0) {
4139- path_to_open = cur_dev->path;
4140- break;
4141- }
4142- }
4143- else {
4144- path_to_open = cur_dev->path;
4145- break;
4146- }
4147- }
4148- cur_dev = cur_dev->next;
4149- }
4150-
4151- if (path_to_open) {
4152- /* Open the device */
4153- handle = hid_open_path(path_to_open);
4154- }
4155-
4156- hid_free_enumeration(devs);
4157-
4158- return handle;
4159-}
4160-
4161-static void hid_device_removal_callback(void *context, IOReturn result,
4162- void *sender, IOHIDDeviceRef dev_ref)
4163-{
4164- /* Stop the Run Loop for this device. */
4165- pthread_mutex_lock(&device_list_mutex);
4166- hid_device *d = device_list;
4167- while (d) {
4168- if (d->device_handle == dev_ref) {
4169- d->disconnected = 1;
4170- CFRunLoopStop(d->run_loop);
4171- }
4172-
4173- d = d->next;
4174- }
4175- pthread_mutex_unlock(&device_list_mutex);
4176-}
4177-
4178-/* The Run Loop calls this function for each input report received.
4179- This function puts the data into a linked list to be picked up by
4180- hid_read(). */
4181-static void hid_report_callback(void *context, IOReturn result, void *sender,
4182- IOHIDReportType report_type, uint32_t report_id,
4183- uint8_t *report, CFIndex report_length)
4184-{
4185- struct input_report *rpt;
4186- hid_device *dev = context;
4187-
4188- /* Make a new Input Report object */
4189- rpt = calloc(1, sizeof(struct input_report));
4190- rpt->data = calloc(1, report_length);
4191- memcpy(rpt->data, report, report_length);
4192- rpt->len = report_length;
4193- rpt->next = NULL;
4194-
4195- /* Lock this section */
4196- pthread_mutex_lock(&dev->mutex);
4197-
4198- /* Attach the new report object to the end of the list. */
4199- if (dev->input_reports == NULL) {
4200- /* The list is empty. Put it at the root. */
4201- dev->input_reports = rpt;
4202- }
4203- else {
4204- /* Find the end of the list and attach. */
4205- struct input_report *cur = dev->input_reports;
4206- int num_queued = 0;
4207- while (cur->next != NULL) {
4208- cur = cur->next;
4209- num_queued++;
4210- }
4211- cur->next = rpt;
4212-
4213- /* Pop one off if we've reached 30 in the queue. This
4214- way we don't grow forever if the user never reads
4215- anything from the device. */
4216- if (num_queued > 30) {
4217- return_data(dev, NULL, 0);
4218- }
4219- }
4220-
4221- /* Signal a waiting thread that there is data. */
4222- pthread_cond_signal(&dev->condition);
4223-
4224- /* Unlock */
4225- pthread_mutex_unlock(&dev->mutex);
4226-
4227-}
4228-
4229-/* This gets called when the read_thred's run loop gets signaled by
4230- hid_close(), and serves to stop the read_thread's run loop. */
4231-static void perform_signal_callback(void *context)
4232-{
4233- hid_device *dev = context;
4234- CFRunLoopStop(dev->run_loop); //TODO: CFRunLoopGetCurrent()
4235-}
4236-
4237-static void *read_thread(void *param)
4238-{
4239- hid_device *dev = param;
4240-
4241- /* Move the device's run loop to this thread. */
4242- IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetCurrent(), dev->run_loop_mode);
4243-
4244- /* Create the RunLoopSource which is used to signal the
4245- event loop to stop when hid_close() is called. */
4246- CFRunLoopSourceContext ctx;
4247- memset(&ctx, 0, sizeof(ctx));
4248- ctx.version = 0;
4249- ctx.info = dev;
4250- ctx.perform = &perform_signal_callback;
4251- dev->source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0/*order*/, &ctx);
4252- CFRunLoopAddSource(CFRunLoopGetCurrent(), dev->source, dev->run_loop_mode);
4253-
4254- /* Store off the Run Loop so it can be stopped from hid_close()
4255- and on device disconnection. */
4256- dev->run_loop = CFRunLoopGetCurrent();
4257-
4258- /* Notify the main thread that the read thread is up and running. */
4259- pthread_barrier_wait(&dev->barrier);
4260-
4261- /* Run the Event Loop. CFRunLoopRunInMode() will dispatch HID input
4262- reports into the hid_report_callback(). */
4263- SInt32 code;
4264- while (!dev->shutdown_thread && !dev->disconnected) {
4265- code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE);
4266- /* Return if the device has been disconnected */
4267- if (code == kCFRunLoopRunFinished) {
4268- dev->disconnected = 1;
4269- break;
4270- }
4271-
4272-
4273- /* Break if The Run Loop returns Finished or Stopped. */
4274- if (code != kCFRunLoopRunTimedOut &&
4275- code != kCFRunLoopRunHandledSource) {
4276- /* There was some kind of error. Setting
4277- shutdown seems to make sense, but
4278- there may be something else more appropriate */
4279- dev->shutdown_thread = 1;
4280- break;
4281- }
4282- }
4283-
4284- /* Now that the read thread is stopping, Wake any threads which are
4285- waiting on data (in hid_read_timeout()). Do this under a mutex to
4286- make sure that a thread which is about to go to sleep waiting on
4287- the condition acutally will go to sleep before the condition is
4288- signaled. */
4289- pthread_mutex_lock(&dev->mutex);
4290- pthread_cond_broadcast(&dev->condition);
4291- pthread_mutex_unlock(&dev->mutex);
4292-
4293- /* Close the OS handle to the device, but only if it's not
4294- been unplugged. If it's been unplugged, then calling
4295- IOHIDDeviceClose() will crash. */
4296- if (!dev->disconnected) {
4297- IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
4298- }
4299-
4300- /* Wait here until hid_close() is called and makes it past
4301- the call to CFRunLoopWakeUp(). This thread still needs to
4302- be valid when that function is called on the other thread. */
4303- pthread_barrier_wait(&dev->shutdown_barrier);
4304-
4305- return NULL;
4306-}
4307-
4308-hid_device * HID_API_EXPORT hid_open_path(const char *path)
4309-{
4310- int i;
4311- hid_device *dev = NULL;
4312- CFIndex num_devices;
4313-
4314- dev = new_hid_device();
4315-
4316- /* Set up the HID Manager if it hasn't been done */
4317- hid_init();
4318-
4319- CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr);
4320-
4321- num_devices = CFSetGetCount(device_set);
4322- IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef));
4323- CFSetGetValues(device_set, (const void **) device_array);
4324- for (i = 0; i < num_devices; i++) {
4325- char cbuf[BUF_LEN];
4326- size_t len;
4327- IOHIDDeviceRef os_dev = device_array[i];
4328-
4329- len = make_path(os_dev, cbuf, sizeof(cbuf));
4330- if (!strcmp(cbuf, path)) {
4331- // Matched Paths. Open this Device.
4332- IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone);
4333- if (ret == kIOReturnSuccess) {
4334- char str[32];
4335-
4336- free(device_array);
4337- CFRelease(device_set);
4338- dev->device_handle = os_dev;
4339-
4340- /* Create the buffers for receiving data */
4341- dev->max_input_report_len = (CFIndex) get_max_report_length(os_dev);
4342- dev->input_report_buf = calloc(dev->max_input_report_len, sizeof(uint8_t));
4343-
4344- /* Create the Run Loop Mode for this device.
4345- printing the reference seems to work. */
4346- sprintf(str, "HIDAPI_%p", os_dev);
4347- dev->run_loop_mode =
4348- CFStringCreateWithCString(NULL, str, kCFStringEncodingASCII);
4349-
4350- /* Attach the device to a Run Loop */
4351- IOHIDDeviceRegisterInputReportCallback(
4352- os_dev, dev->input_report_buf, dev->max_input_report_len,
4353- &hid_report_callback, dev);
4354- IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, hid_device_removal_callback, NULL);
4355-
4356- /* Start the read thread */
4357- pthread_create(&dev->thread, NULL, read_thread, dev);
4358-
4359- /* Wait here for the read thread to be initialized. */
4360- pthread_barrier_wait(&dev->barrier);
4361-
4362- return dev;
4363- }
4364- else {
4365- goto return_error;
4366- }
4367- }
4368- }
4369-
4370-return_error:
4371- free(device_array);
4372- CFRelease(device_set);
4373- free_hid_device(dev);
4374- return NULL;
4375-}
4376-
4377-static int set_report(hid_device *dev, IOHIDReportType type, const unsigned char *data, size_t length)
4378-{
4379- const unsigned char *data_to_send;
4380- size_t length_to_send;
4381- IOReturn res;
4382-
4383- /* Return if the device has been disconnected. */
4384- if (dev->disconnected)
4385- return -1;
4386-
4387- if (data[0] == 0x0) {
4388- /* Not using numbered Reports.
4389- Don't send the report number. */
4390- data_to_send = data+1;
4391- length_to_send = length-1;
4392- }
4393- else {
4394- /* Using numbered Reports.
4395- Send the Report Number */
4396- data_to_send = data;
4397- length_to_send = length;
4398- }
4399-
4400- if (!dev->disconnected) {
4401- res = IOHIDDeviceSetReport(dev->device_handle,
4402- type,
4403- data[0], /* Report ID*/
4404- data_to_send, length_to_send);
4405-
4406- if (res == kIOReturnSuccess) {
4407- return length;
4408- }
4409- else
4410- return -1;
4411- }
4412-
4413- return -1;
4414-}
4415-
4416-int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
4417-{
4418- return set_report(dev, kIOHIDReportTypeOutput, data, length);
4419-}
4420-
4421-/* Helper function, so that this isn't duplicated in hid_read(). */
4422-static int return_data(hid_device *dev, unsigned char *data, size_t length)
4423-{
4424- /* Copy the data out of the linked list item (rpt) into the
4425- return buffer (data), and delete the liked list item. */
4426- struct input_report *rpt = dev->input_reports;
4427- size_t len = (length < rpt->len)? length: rpt->len;
4428- memcpy(data, rpt->data, len);
4429- dev->input_reports = rpt->next;
4430- free(rpt->data);
4431- free(rpt);
4432- return len;
4433-}
4434-
4435-static int cond_wait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex)
4436-{
4437- while (!dev->input_reports) {
4438- int res = pthread_cond_wait(cond, mutex);
4439- if (res != 0)
4440- return res;
4441-
4442- /* A res of 0 means we may have been signaled or it may
4443- be a spurious wakeup. Check to see that there's acutally
4444- data in the queue before returning, and if not, go back
4445- to sleep. See the pthread_cond_timedwait() man page for
4446- details. */
4447-
4448- if (dev->shutdown_thread || dev->disconnected)
4449- return -1;
4450- }
4451-
4452- return 0;
4453-}
4454-
4455-static int cond_timedwait(const hid_device *dev, pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
4456-{
4457- while (!dev->input_reports) {
4458- int res = pthread_cond_timedwait(cond, mutex, abstime);
4459- if (res != 0)
4460- return res;
4461-
4462- /* A res of 0 means we may have been signaled or it may
4463- be a spurious wakeup. Check to see that there's acutally
4464- data in the queue before returning, and if not, go back
4465- to sleep. See the pthread_cond_timedwait() man page for
4466- details. */
4467-
4468- if (dev->shutdown_thread || dev->disconnected)
4469- return -1;
4470- }
4471-
4472- return 0;
4473-
4474-}
4475-
4476-int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
4477-{
4478- int bytes_read = -1;
4479-
4480- /* Lock the access to the report list. */
4481- pthread_mutex_lock(&dev->mutex);
4482-
4483- /* There's an input report queued up. Return it. */
4484- if (dev->input_reports) {
4485- /* Return the first one */
4486- bytes_read = return_data(dev, data, length);
4487- goto ret;
4488- }
4489-
4490- /* Return if the device has been disconnected. */
4491- if (dev->disconnected) {
4492- bytes_read = -1;
4493- goto ret;
4494- }
4495-
4496- if (dev->shutdown_thread) {
4497- /* This means the device has been closed (or there
4498- has been an error. An error code of -1 should
4499- be returned. */
4500- bytes_read = -1;
4501- goto ret;
4502- }
4503-
4504- /* There is no data. Go to sleep and wait for data. */
4505-
4506- if (milliseconds == -1) {
4507- /* Blocking */
4508- int res;
4509- res = cond_wait(dev, &dev->condition, &dev->mutex);
4510- if (res == 0)
4511- bytes_read = return_data(dev, data, length);
4512- else {
4513- /* There was an error, or a device disconnection. */
4514- bytes_read = -1;
4515- }
4516- }
4517- else if (milliseconds > 0) {
4518- /* Non-blocking, but called with timeout. */
4519- int res;
4520- struct timespec ts;
4521- struct timeval tv;
4522- gettimeofday(&tv, NULL);
4523- TIMEVAL_TO_TIMESPEC(&tv, &ts);
4524- ts.tv_sec += milliseconds / 1000;
4525- ts.tv_nsec += (milliseconds % 1000) * 1000000;
4526- if (ts.tv_nsec >= 1000000000L) {
4527- ts.tv_sec++;
4528- ts.tv_nsec -= 1000000000L;
4529- }
4530-
4531- res = cond_timedwait(dev, &dev->condition, &dev->mutex, &ts);
4532- if (res == 0)
4533- bytes_read = return_data(dev, data, length);
4534- else if (res == ETIMEDOUT)
4535- bytes_read = 0;
4536- else
4537- bytes_read = -1;
4538- }
4539- else {
4540- /* Purely non-blocking */
4541- bytes_read = 0;
4542- }
4543-
4544-ret:
4545- /* Unlock */
4546- pthread_mutex_unlock(&dev->mutex);
4547- return bytes_read;
4548-}
4549-
4550-int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length)
4551-{
4552- return hid_read_timeout(dev, data, length, (dev->blocking)? -1: 0);
4553-}
4554-
4555-int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
4556-{
4557- /* All Nonblocking operation is handled by the library. */
4558- dev->blocking = !nonblock;
4559-
4560- return 0;
4561-}
4562-
4563-int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
4564-{
4565- return set_report(dev, kIOHIDReportTypeFeature, data, length);
4566-}
4567-
4568-int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
4569-{
4570- CFIndex len = length;
4571- IOReturn res;
4572-
4573- /* Return if the device has been unplugged. */
4574- if (dev->disconnected)
4575- return -1;
4576-
4577- res = IOHIDDeviceGetReport(dev->device_handle,
4578- kIOHIDReportTypeFeature,
4579- data[0], /* Report ID */
4580- data, &len);
4581- if (res == kIOReturnSuccess)
4582- return len;
4583- else
4584- return -1;
4585-}
4586-
4587-
4588-void HID_API_EXPORT hid_close(hid_device *dev)
4589-{
4590- if (!dev)
4591- return;
4592-
4593- /* Disconnect the report callback before close. */
4594- if (!dev->disconnected) {
4595- IOHIDDeviceRegisterInputReportCallback(
4596- dev->device_handle, dev->input_report_buf, dev->max_input_report_len,
4597- NULL, dev);
4598- IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, NULL, dev);
4599- IOHIDDeviceUnscheduleFromRunLoop(dev->device_handle, dev->run_loop, dev->run_loop_mode);
4600- IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetMain(), kCFRunLoopDefaultMode);
4601- }
4602-
4603- /* Cause read_thread() to stop. */
4604- dev->shutdown_thread = 1;
4605-
4606- /* Wake up the run thread's event loop so that the thread can exit. */
4607- CFRunLoopSourceSignal(dev->source);
4608- CFRunLoopWakeUp(dev->run_loop);
4609-
4610- /* Notify the read thread that it can shut down now. */
4611- pthread_barrier_wait(&dev->shutdown_barrier);
4612-
4613- /* Wait for read_thread() to end. */
4614- pthread_join(dev->thread, NULL);
4615-
4616- /* Close the OS handle to the device, but only if it's not
4617- been unplugged. If it's been unplugged, then calling
4618- IOHIDDeviceClose() will crash. */
4619- if (!dev->disconnected) {
4620- IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
4621- }
4622-
4623- /* Clear out the queue of received reports. */
4624- pthread_mutex_lock(&dev->mutex);
4625- while (dev->input_reports) {
4626- return_data(dev, NULL, 0);
4627- }
4628- pthread_mutex_unlock(&dev->mutex);
4629-
4630- free_hid_device(dev);
4631-}
4632-
4633-int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen)
4634-{
4635- return get_manufacturer_string(dev->device_handle, string, maxlen);
4636-}
4637-
4638-int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen)
4639-{
4640- return get_product_string(dev->device_handle, string, maxlen);
4641-}
4642-
4643-int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen)
4644-{
4645- return get_serial_number(dev->device_handle, string, maxlen);
4646-}
4647-
4648-int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
4649-{
4650- // TODO:
4651-
4652- return 0;
4653-}
4654-
4655-
4656-HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
4657-{
4658- // TODO:
4659-
4660- return NULL;
4661-}
4662-
4663-
4664-
4665-
4666-
4667-
4668-#if 0
4669-static int32_t get_location_id(IOHIDDeviceRef device)
4670-{
4671- return get_int_property(device, CFSTR(kIOHIDLocationIDKey));
4672-}
4673-
4674-static int32_t get_usage(IOHIDDeviceRef device)
4675-{
4676- int32_t res;
4677- res = get_int_property(device, CFSTR(kIOHIDDeviceUsageKey));
4678- if (!res)
4679- res = get_int_property(device, CFSTR(kIOHIDPrimaryUsageKey));
4680- return res;
4681-}
4682-
4683-static int32_t get_usage_page(IOHIDDeviceRef device)
4684-{
4685- int32_t res;
4686- res = get_int_property(device, CFSTR(kIOHIDDeviceUsagePageKey));
4687- if (!res)
4688- res = get_int_property(device, CFSTR(kIOHIDPrimaryUsagePageKey));
4689- return res;
4690-}
4691-
4692-static int get_transport(IOHIDDeviceRef device, wchar_t *buf, size_t len)
4693-{
4694- return get_string_property(device, CFSTR(kIOHIDTransportKey), buf, len);
4695-}
4696-
4697-
4698-int main(void)
4699-{
4700- IOHIDManagerRef mgr;
4701- int i;
4702-
4703- mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
4704- IOHIDManagerSetDeviceMatching(mgr, NULL);
4705- IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);
4706-
4707- CFSetRef device_set = IOHIDManagerCopyDevices(mgr);
4708-
4709- CFIndex num_devices = CFSetGetCount(device_set);
4710- IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef));
4711- CFSetGetValues(device_set, (const void **) device_array);
4712-
4713- setlocale(LC_ALL, "");
4714-
4715- for (i = 0; i < num_devices; i++) {
4716- IOHIDDeviceRef dev = device_array[i];
4717- printf("Device: %p\n", dev);
4718- printf(" %04hx %04hx\n", get_vendor_id(dev), get_product_id(dev));
4719-
4720- wchar_t serial[256], buf[256];
4721- char cbuf[256];
4722- get_serial_number(dev, serial, 256);
4723-
4724-
4725- printf(" Serial: %ls\n", serial);
4726- printf(" Loc: %ld\n", get_location_id(dev));
4727- get_transport(dev, buf, 256);
4728- printf(" Trans: %ls\n", buf);
4729- make_path(dev, cbuf, 256);
4730- printf(" Path: %s\n", cbuf);
4731-
4732- }
4733-
4734- return 0;
4735-}
4736-#endif
4737
4738=== removed directory 'mixxx/lib/hidapi-0.7.0/windows'
4739=== removed file 'mixxx/lib/hidapi-0.7.0/windows/.gitignore'
4740--- mixxx/lib/hidapi-0.7.0/windows/.gitignore 2012-01-28 09:23:48 +0000
4741+++ mixxx/lib/hidapi-0.7.0/windows/.gitignore 1970-01-01 00:00:00 +0000
4742@@ -1,11 +0,0 @@
4743-Debug
4744-Release
4745-*.exp
4746-*.ilk
4747-*.lib
4748-*.suo
4749-*.vcproj.*
4750-*.ncb
4751-*.suo
4752-*.dll
4753-*.pdb
4754
4755=== removed file 'mixxx/lib/hidapi-0.7.0/windows/Makefile'
4756--- mixxx/lib/hidapi-0.7.0/windows/Makefile 2012-01-28 09:23:48 +0000
4757+++ mixxx/lib/hidapi-0.7.0/windows/Makefile 1970-01-01 00:00:00 +0000
4758@@ -1,14 +0,0 @@
4759-
4760-
4761-OS=$(shell uname)
4762-
4763-ifneq (,$(findstring MINGW,$(OS)))
4764- FILE=Makefile.mingw
4765-endif
4766-
4767-ifeq ($(FILE), )
4768-all:
4769- $(error Your platform ${OS} is not supported at this time.)
4770-endif
4771-
4772-include $(FILE)
4773
4774=== removed file 'mixxx/lib/hidapi-0.7.0/windows/Makefile.mingw'
4775--- mixxx/lib/hidapi-0.7.0/windows/Makefile.mingw 2012-01-28 09:23:48 +0000
4776+++ mixxx/lib/hidapi-0.7.0/windows/Makefile.mingw 1970-01-01 00:00:00 +0000
4777@@ -1,32 +0,0 @@
4778-###########################################
4779-# Simple Makefile for HIDAPI test program
4780-#
4781-# Alan Ott
4782-# Signal 11 Software
4783-# 2010-06-01
4784-###########################################
4785-
4786-all: hidtest
4787-
4788-CC=gcc
4789-CXX=g++
4790-COBJS=hid.o
4791-CPPOBJS=../hidtest/hidtest.o
4792-OBJS=$(COBJS) $(CPPOBJS)
4793-CFLAGS=-I../hidapi -g -c
4794-LIBS= -lsetupapi
4795-
4796-
4797-hidtest: $(OBJS)
4798- g++ -g $^ $(LIBS) -o hidtest
4799-
4800-$(COBJS): %.o: %.c
4801- $(CC) $(CFLAGS) $< -o $@
4802-
4803-$(CPPOBJS): %.o: %.cpp
4804- $(CXX) $(CFLAGS) $< -o $@
4805-
4806-clean:
4807- rm *.o ../hidtest/*.o hidtest.exe
4808-
4809-.PHONY: clean
4810
4811=== removed directory 'mixxx/lib/hidapi-0.7.0/windows/ddk_build'
4812=== removed file 'mixxx/lib/hidapi-0.7.0/windows/ddk_build/.gitignore'
4813--- mixxx/lib/hidapi-0.7.0/windows/ddk_build/.gitignore 2012-01-28 09:23:48 +0000
4814+++ mixxx/lib/hidapi-0.7.0/windows/ddk_build/.gitignore 1970-01-01 00:00:00 +0000
4815@@ -1,2 +0,0 @@
4816-*.log
4817-obj*_*_*
4818\ No newline at end of file
4819
4820=== removed file 'mixxx/lib/hidapi-0.7.0/windows/ddk_build/hidapi.def'
4821--- mixxx/lib/hidapi-0.7.0/windows/ddk_build/hidapi.def 2012-01-28 09:23:48 +0000
4822+++ mixxx/lib/hidapi-0.7.0/windows/ddk_build/hidapi.def 1970-01-01 00:00:00 +0000
4823@@ -1,17 +0,0 @@
4824-LIBRARY hidapi
4825-EXPORTS
4826- hid_open @1
4827- hid_write @2
4828- hid_read @3
4829- hid_close @4
4830- hid_get_product_string @5
4831- hid_get_manufacturer_string @6
4832- hid_get_serial_number_string @7
4833- hid_get_indexed_string @8
4834- hid_error @9
4835- hid_set_nonblocking @10
4836- hid_enumerate @11
4837- hid_open_path @12
4838- hid_send_feature_report @13
4839- hid_get_feature_report @14
4840-
4841\ No newline at end of file
4842
4843=== removed file 'mixxx/lib/hidapi-0.7.0/windows/ddk_build/makefile'
4844--- mixxx/lib/hidapi-0.7.0/windows/ddk_build/makefile 2012-01-28 09:23:48 +0000
4845+++ mixxx/lib/hidapi-0.7.0/windows/ddk_build/makefile 1970-01-01 00:00:00 +0000
4846@@ -1,49 +0,0 @@
4847-#############################################################################
4848-#
4849-# Copyright (C) Microsoft Corporation 1995, 1996
4850-# All Rights Reserved.
4851-#
4852-# MAKEFILE for HID directory
4853-#
4854-#############################################################################
4855-
4856-!IFDEF WIN95_BUILD
4857-
4858-ROOT=..\..\..\..
4859-
4860-VERSIONLIST = debug retail
4861-IS_32 = TRUE
4862-IS_SDK = TRUE
4863-IS_PRIVATE = TRUE
4864-IS_SDK = TRUE
4865-IS_DDK = TRUE
4866-WIN32 = TRUE
4867-COMMONMKFILE = hidapi.mk
4868-
4869-!include $(ROOT)\dev\master.mk
4870-
4871-
4872-!ELSE
4873-
4874-#
4875-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
4876-# file to this component. This file merely indirects to the real make file
4877-# that is shared by all the driver components of the Windows NT DDK
4878-#
4879-
4880-!IF DEFINED(_NT_TARGET_VERSION)
4881-! IF $(_NT_TARGET_VERSION)>=0x501
4882-! INCLUDE $(NTMAKEENV)\makefile.def
4883-! ELSE
4884-# Only warn once per directory
4885-! INCLUDE $(NTMAKEENV)\makefile.plt
4886-! IF "$(BUILD_PASS)"=="PASS1"
4887-! message BUILDMSG: Warning : The sample "$(MAKEDIR)" is not valid for the current OS target.
4888-! ENDIF
4889-! ENDIF
4890-!ELSE
4891-! INCLUDE $(NTMAKEENV)\makefile.def
4892-!ENDIF
4893-
4894-!ENDIF
4895-
4896
4897=== removed file 'mixxx/lib/hidapi-0.7.0/windows/ddk_build/sources'
4898--- mixxx/lib/hidapi-0.7.0/windows/ddk_build/sources 2012-01-28 09:23:48 +0000
4899+++ mixxx/lib/hidapi-0.7.0/windows/ddk_build/sources 1970-01-01 00:00:00 +0000
4900@@ -1,23 +0,0 @@
4901-TARGETNAME=hidapi
4902-TARGETTYPE=DYNLINK
4903-UMTYPE=console
4904-UMENTRY=main
4905-
4906-MSC_WARNING_LEVEL=/W3 /WX
4907-
4908-TARGETLIBS=$(SDK_LIB_PATH)\hid.lib \
4909- $(SDK_LIB_PATH)\setupapi.lib \
4910- $(SDK_LIB_PATH)\kernel32.lib \
4911- $(SDK_LIB_PATH)\comdlg32.lib
4912-
4913-USE_MSVCRT=1
4914-
4915-INCLUDES= ..\..\hidapi
4916-SOURCES= ..\hid.c \
4917-
4918-
4919-TARGET_DESTINATION=retail
4920-
4921-MUI=0
4922-MUI_COMMENT="HID Interface DLL"
4923-
4924
4925=== removed file 'mixxx/lib/hidapi-0.7.0/windows/hid.c'
4926--- mixxx/lib/hidapi-0.7.0/windows/hid.c 2012-01-28 09:23:48 +0000
4927+++ mixxx/lib/hidapi-0.7.0/windows/hid.c 1970-01-01 00:00:00 +0000
4928@@ -1,873 +0,0 @@
4929-/*******************************************************
4930- HIDAPI - Multi-Platform library for
4931- communication with HID devices.
4932-
4933- Alan Ott
4934- Signal 11 Software
4935-
4936- 8/22/2009
4937-
4938- Copyright 2009, All Rights Reserved.
4939-
4940- At the discretion of the user of this library,
4941- this software may be licensed under the terms of the
4942- GNU Public License v3, a BSD-Style license, or the
4943- original HIDAPI license as outlined in the LICENSE.txt,
4944- LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
4945- files located at the root of the source distribution.
4946- These files may also be found in the public source
4947- code repository located at:
4948- http://github.com/signal11/hidapi .
4949-********************************************************/
4950-
4951-#include <windows.h>
4952-
4953-#ifndef _NTDEF_
4954-typedef LONG NTSTATUS;
4955-#endif
4956-
4957-#ifdef __MINGW32__
4958-#include <ntdef.h>
4959-#include <winbase.h>
4960-#endif
4961-
4962-#ifdef __CYGWIN__
4963-#include <ntdef.h>
4964-#define _wcsdup wcsdup
4965-#endif
4966-
4967-//#define HIDAPI_USE_DDK
4968-
4969-#ifdef __cplusplus
4970-extern "C" {
4971-#endif
4972- #include <setupapi.h>
4973- #include <winioctl.h>
4974- #ifdef HIDAPI_USE_DDK
4975- #include <hidsdi.h>
4976- #endif
4977-
4978- // Copied from inc/ddk/hidclass.h, part of the Windows DDK.
4979- #define HID_OUT_CTL_CODE(id) \
4980- CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
4981- #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
4982-
4983-#ifdef __cplusplus
4984-} // extern "C"
4985-#endif
4986-
4987-#include <stdio.h>
4988-#include <stdlib.h>
4989-
4990-
4991-#include "hidapi.h"
4992-
4993-#ifdef _MSC_VER
4994- // Thanks Microsoft, but I know how to use strncpy().
4995- #pragma warning(disable:4996)
4996-#endif
4997-
4998-#ifdef __cplusplus
4999-extern "C" {
5000-#endif
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: