解決MacOS機械鍵盤按鍵錯亂的問題

先說說本人配置:

1.鍵盤為TESORO TS-G7N(108鍵的cherry紅軸 當時買成179 ?? 強烈安利??!性價比超高?。。?br>

2.電腦和系統(tǒng)的情況
電腦配置.png

解決方法(目前有兩種):

1.第一種方法,使用轉(zhuǎn)接頭usb->ps/2->usb,貌似淘寶上有賣的,但不穩(wěn)定,且又要等物流,先放棄。

2.第二種方法,利用軟件更改,本著程序員刻苦鉆研的精神,遂決定用它了,那么踩坑之旅就此開始了????

Supported Devices

  • Noppoo Choc Mini (1006:0022, 1007:8400)
  • Noppoo Choc Mid (04d9:1829)
  • Noppoo Choc Pro (04f3:5a5a, 06fe:104e)
  • Tt eSPORTS Poseidon Z (0566:3067)
  • Tt eSPORTS Poseidon ZX (0566:3063)
  • Ozone StrikeBattle (04d9:a096)
  • Patech JP-PC35B (04d9:a0cd) (untested)
    Including the support from the [original project]>(https://github.com/thefloweringash/iousbhiddriver-descriptor->override#acknowledgements) for
  • Griffin PowerMate
  • Macally iShock

what!沒有我的這款鍵盤,這就很難受了,死馬當活馬醫(yī)吧,抱著試一試的態(tài)度直接下載安裝https://thefloweringash.com/iousbhiddriver-descriptor-override/downloads/這里面的最新版,看看是否能碰巧可以用上。然而并沒有什么用,依然亂鍵??

  • 這可怎么玩兒??不急,仔細瀏覽了一下大佬的文檔發(fā)現(xiàn)可以添加自己的鍵盤信息在里面

Unsupported Devices
The Noppoo devices have a range of identifiers and descriptors. If a device is not supported, there is an experimental feature that will generate the Info.plist section for any connected device that has the Noppoo-style overlapping descriptors.
# dependencies
brew install libusb
bundle install --without ""
# build
rake scan
A file for your keyboard will be generated in the descriptors directory. Follow the instructions in the previous section to install the resulting module.

This feature is experimental, but works for limited test cases. If the resulting .kext works with your keyboard, submit a pull request with the new descriptors, otherwise open an issue with the new descriptors.

大佬的意思大概是:沒有的設(shè)備可以通過掃描添加進去。

好吧,那就開始弄吧。
1.先把整個項目下載下來,Download Zip;
2.按大佬步驟做:

# dependencies
brew install libusb
bundle install --without ""
# build
rake scan

打開終端輸入brew install libusb, 等等,哎呀我去。。。第一步就直接涼了(應(yīng)該是我沒怎么用過mac),提示:

-bash: brew: command not found

注意啦,第一個坑來了!
百度一番,說是要修改.bash_profile文件

sudo vim .bash_profile
輸入密碼之后添加下一行
export PATH=/usr/local/bin:$PATH
最后記得
source .bash_profile使配置修改生效。
×_× 沒有用!

算了算了,繼續(xù)找找吧,發(fā)現(xiàn)需要安裝Homebrew(應(yīng)該用mac的程序員都會安裝這個吧)
看官網(wǎng),安裝簡單一句話的事兒:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

左等右等,我去 又報錯了!

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation

讓我來看看什么原因呢,貌似網(wǎng)絡(luò)不行,得用外網(wǎng)!尋尋覓覓找了個梯子,搞了半天還是不行!最終多次嘗試之下找到了一個方法:
https://raw.githubusercontent.com/Homebrew/install/master/install直接訪問這網(wǎng)站,最好用梯子。將網(wǎng)頁的內(nèi)容復(fù)制下來保存為brew_install.rb文件;
②用文本編輯器,將文件中的內(nèi)容

BREW_REPO = "https://github.com/Homebrew/brew".freeze
替換為清華源
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze

③用終端,進入存放這個文件的目錄輸入 ruby brew_install.rb,等待慢慢安裝
④當出現(xiàn)這個時,不用等了,直接終止命令

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

⑤用終端,進入taps目錄下的homebrew目錄,如果沒有就手動創(chuàng)建目錄,等待clone homebrew-core

cd /usr/local/Homebrew/Library/Taps/homebrew
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

⑥clone完成后,將homebrew切換為清華鏡像

cd "$(brew --repo)"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update

⑦終端顯示Already up-to-date,那么恭喜homebrew就安裝完畢了

好吧終于安裝好了homebrew,那么回到正題!輸入

brew install libusb

終于成功了!

==> Pouring libusb-1.0.23.high_sierra.bottle.tar.gz
Warning: This keg was marked linked already, continuing anyway
?? /usr/local/Cellar/libusb/1.0.23: 29 files, 524.3KB

馬不停蹄,輸入第二個命令(第二個坑 要進入大佬那個iousbhiddriver-descriptor-override-master文件夾中)

bundle install --without ""

在使用bundle命令之前可能需要安裝bundler

gem install bundler

貌似也沒問題,那就繼續(xù)唄

rake scan

報錯了!果然沒有這么容易搞定。左思右想,對比了一下Gemfile.lock文件,發(fā)現(xiàn)事情有點蹊蹺,bundle install的輸入日志如下:

Using rake 10.4.2
Using bundler 2.0.2
Using diff-lcs 1.2.5
Using plist 3.1.0
Using rspec-support 3.4.1
Using rspec-core 3.4.1
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using rspec 3.4.0
Bundle complete! 4 Gemfile dependencies, 9 gems now installed.

與文件中相比,少了ffi和libusb兩個gem。
網(wǎng)上各種一頓亂搜,終于發(fā)現(xiàn)了問題所在(可憐我找了一天??)
在Gemfile文件中有這樣一句話:

group :scan do
  gem "libusb"
end

用大佬的bundle install --without ""不能加載,有可能是bundle版本的問題,需要使用

bundle install --with scan

神奇的事情發(fā)生了,輸出日志中多了兩項:

Using ffi 1.9.10
Using libusb 0.5.1
Bundle complete! 4 Gemfile dependencies, 11 gems now installed.

那么我們開始愉快的使用rake scan吧,

Writing details to descriptors/195d-2049-TESORO_Gaming_Keyboard.yaml

在descriptors目錄下多了一個yaml文件,說明成功讀取了機械鍵盤設(shè)備信息。成功了一半了,加油!
馬上進行安裝,用終端進入iousbhiddriver-descriptor-override-master文件夾中

gem install bundler(如果安裝了,請忽略)
bundle install --without scan

用xcode編譯構(gòu)建
第三個坑 注意:xcode需要用低版本的,我用的Version 8.3 (8E162)可以通過

xcodebuild
sudo cp -r build/Release/IOUSBHIDDriverDescriptorOverride.kext \
/System/Library/Extensions
sudo kextutil \
/System/Library/Extensions/IOUSBHIDDriverDescriptorOverride.kext

激動人心的時刻來臨了,敲了下鍵盤,納尼!還是不行我去,重新插拔了一下,也不行。我滴個心瞬間涼了一半了,搞了這么久還是不行。苦思冥想,有可能是外接設(shè)備插多了的原因,只留了一個鍵盤一個鼠標,用虛擬鍵盤重新跑一遍上面的步驟。

終于成功了?。?!

其他

真的不容易,其實還有很多其他的坑!這里就不一一贅述了,希望大家都用上自己喜歡的機械鍵盤????

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容