2016-04-22 7 views
1

私はWacomタブレットを自動的にセットアップする簡単なbashスクリプトを設定することにしましたが、いくつか問題があります。Xsetwacomは正常に動作しますが、bashスクリプト内では実行されません

#!/bin/bash 

#Used to setup my Wacom Tablet (Intous Draw) 
xsetwacom --list 
echo "Setting up Wacom Tablet..." 
sudo modprobe -r wacom 
sudo modprobe -r wacom_w8001 
sudo modprobe wacom 
sudo modprobe wacom_w8001 
echo "Configuring pen buttons..." 
xsetwacom set "Wacom Intuos S 2 Pen stylus" Button 2 key +space 
echo "Configuring tablet buttons..." 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 1 key +ctrl z -ctrl 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 3 key +ctrl 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 8 key +ctrl +shift z -shift -ctrl 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 9 key +alt +shift +ctrl k -ctrl -shift - alt 
echo "Mapping tablet to DVI-0..." 
xsetwacom set "Wacom Intuos S 2 Pen stylus" MapToOutput DVI-0 
echo "Done!" 
exit 0 

私は手動でこれらのコマンドを入力した場合、彼らは、何のエラーが正常に動作していないが、私はbashスクリプトに入れて、それを実行したら、私は次のエラーを取得:

Wacom Intuos S 2 Pen stylus   id: 13 type: STYLUS  
Wacom Intuos S 2 Pad pad   id: 14 type: PAD  
Setting up Wacom Tablet... 
Configuring pen buttons... 
Cannot find device 'Wacom Intuos S 2 Pen stylus'. 
Configuring tablet buttons... 
Cannot find device 'Wacom Intuos S 2 Pad pad'. 
Cannot find device 'Wacom Intuos S 2 Pad pad'. 
Cannot find device 'Wacom Intuos S 2 Pad pad'. 
Cannot find device 'Wacom Intuos S 2 Pad pad'. 
Mapping tablet to DVI-0... 
Cannot find device 'Wacom Intuos S 2 Pen stylus'. 
Done! 
ここにファイルがあります

最初のコマンドは使用可能なデバイスを一覧表示して(接続されていることを確認する)、その他はボタンを設定してモニタにマッピングします。私はスペルが正しいこと、そしてコマンドが正しく書かれていることを確認しましたが、それでも動作しません。 sudoを使っても役に立ちません。 xsetwacomにはroot権限は必要ありません。

+0

コマンドは、スクリプトコマンドが失敗した同じ端末から手動で動作しますか? –

答えて

0

申し訳ありませんが、解決策が見つかりました。 Xsetwacomはこれらのコマンドをすばやく実行することはできません。スクリプトにsleepコマンドを追加すると、このトリックが実行されたようです。

#!/bin/bash 

#Used to setup my Wacom Tablet (Intous Draw) 
echo "Setting up Wacom Tablet..." 
sudo modprobe -r wacom 
sudo modprobe -r wacom_w8001 
sudo modprobe wacom 
sudo modprobe wacom_w8001 
echo "Configuring pen buttons..." 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pen stylus" Button 2 key +space 
echo "Configuring tablet buttons..." 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 1 key +ctrl z -ctrl 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 3 key +ctrl 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 8 key +ctrl +shift z -shift -ctrl 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 9 key +alt +shift +ctrl k -ctrl -shift - alt 
echo "Mapping tablet to DVI-0..." 
sleep 0.1 
xsetwacom set "Wacom Intuos S 2 Pen stylus" MapToOutput DVI-0 
echo "Done!" 
exit 0 
関連する問題