File manual-claiming.diff of Package g213colors-gui
--- G213Colors-0.5/G213Colors.py 2017-10-02 15:50:55.000000000 +0200
+++ G213Colors-0.5/G213Colors.py.new 2018-05-19 03:15:37.559740756 +0200
@@ -83,7 +83,12 @@
print("Disconnected " + productName)
def receiveData():
- device.read(0x82, 64)
+ return(None)
+ usb.util.claim_interface(device,wIndex)
+ try:
+ device.read(0x82, 64)
+ finally:
+ usb.util.release_interface(device,wIndex)
def sendData(data):
global productName
@@ -92,7 +97,11 @@
print(bmRequestType, bmRequest, wValue[productName], wIndex, binascii.unhexlify(data))
# free device resource to uest, wValue[productName], wIndex, binascii.unhexlify(data))
# decode data to binary and send it
- device.ctrl_transfer(bmRequestType, bmRequest, wValue[productName], wIndex, binascii.unhexlify(data))
+ usb.util.claim_interface(device,wIndex)
+ try:
+ device.ctrl_transfer(bmRequestType, bmRequest, wValue[productName], wIndex, binascii.unhexlify(data))
+ finally:
+ usb.util.release_interface(device,wIndex)
def sendColorCommand(colorHex, field=0):
global productName