Go to the documentation of this file.00001
00002 import os,time,subprocess
00003
00004 HYDRA_INDEX = -1
00005
00006 cmd = "ls /dev/hidraw*"
00007 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
00008 devices = p.readlines()
00009
00010
00011 for i in range(len(devices)):
00012 cmd = "cat /sys/class/hidraw/hidraw"+str(i)+"/device/uevent"
00013 p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
00014 lines= p.readlines()
00015
00016 if 'HID_NAME=Razer Razer Hydra\n' in lines:
00017 HYDRA_INDEX = i
00018 break
00019
00020
00021 print "device %d is the Razer Hydra"%(HYDRA_INDEX)
00022
00023
00024