0
pyusbを使って有線のXbox 360ゲームパッドとやりとりしたいと思っています。これまでのところ私はうまく読むことができますが、私はLEDを点滅させないように書きたいと思っています。pyusbを使ってxbox 360ゲームパッドのLEDを制御する方法
hereと表示されていますが、どのようなメッセージを送信しようとしても、私はLEDを制御する運がありません。以下は私がこれまでに持っていたコードです。
import usb
dev = usb.core.find(idVendor=1118, idProduct=654)
dev.set_configuration()
readEP = dev[0][(0,0)][0] #endpoint to read from
writeEP = dev[0][(0,0)][1] #endpoint to write to
print readEP #should be: <ENDPOINT 0x81: Interrupt IN>
print writeEP #should be: <ENDPOINT 0x1: Interrupt OUT>
##read the startup messages
for i in range(4): #usually only 4 messages
data = dev.read(readEP.bEndpointAddress,readEP.wMaxPacketSize,100)
print len(data) #should be 3
##get initial button/axes state
data = dev.read(readEP.bEndpointAddress,readEP.wMaxPacketSize,100)
print len(data) #should be 20
##Try to set the LED to illuminate just one element (message 0x06).
##Each of the following commented-out attempts fails to leave only the first
##element illuminated and subsequent attempts at reading or writing yields
##"usb.core.USBError: [Errno 5] Input/Output Error"
dev.write(writeEP,'010306',100)
# dev.write(writeEP,'0\x010306',100)
# dev.write(writeEP,'66310',100) #decimal value of 0x010306
##attempt to read again
while True:
data = dev.read(readEP.bEndpointAddress,readEP.wMaxPacketSize,100)