fix hidconsole input
This commit is contained in:
parent
216928f904
commit
41e84e55f1
|
@ -14,7 +14,7 @@ import hidapi
|
||||||
#
|
#
|
||||||
|
|
||||||
# no Python 3 support :(
|
# no Python 3 support :(
|
||||||
read_packet = input
|
read_packet = raw_input
|
||||||
interactive = os.isatty(0)
|
interactive = os.isatty(0)
|
||||||
prompt = '?? Input: ' if interactive else ''
|
prompt = '?? Input: ' if interactive else ''
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,21 @@ from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def solaar_init():
|
def init_paths():
|
||||||
|
"""Make the app work in the source tree."""
|
||||||
|
import sys
|
||||||
import os.path as _path
|
import os.path as _path
|
||||||
|
|
||||||
prefix = _path.dirname(_path.dirname(_path.realpath(_path.abspath(__file__))))
|
src_lib = _path.normpath(_path.join(_path.realpath(sys.path[0]), '..', 'src'))
|
||||||
|
init_py = _path.join(src_lib, 'hidapi', '__init__.py')
|
||||||
dist_lib = _path.join(prefix, 'share', 'solaar', 'lib')
|
|
||||||
src_lib = _path.join(prefix, 'src')
|
|
||||||
|
|
||||||
for location in (dist_lib, src_lib):
|
|
||||||
init_py = _path.join(location, 'hidapi', '__init__.py')
|
|
||||||
if _path.exists(init_py):
|
if _path.exists(init_py):
|
||||||
sys.path.insert(1, location)
|
sys.path[0] = src_lib
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if sys.version_info >= (2, 8):
|
if sys.version_info >= (2, 8):
|
||||||
sys.exit("Python 3 is not supported by hidconsole.")
|
sys.exit("Python 3 is not supported by hidconsole.")
|
||||||
|
|
||||||
solaar_init()
|
init_paths()
|
||||||
from hidapi import hidconsole
|
from hidapi import hidconsole
|
||||||
hidconsole.main()
|
hidconsole.main()
|
||||||
|
|
Loading…
Reference in New Issue