summaryrefslogtreecommitdiff
path: root/decode.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2010-04-18 01:58:45 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2010-04-18 01:58:45 +0200
commit2454527da4eeb27683f64ffdc3311d4ac00b3a04 (patch)
tree7660794f13a7d68da331288c74d72811e792430b /decode.c
parentc11d3c15af2e3ebd04af9326a5f95f9b212f6a8d (diff)
downloadlibsigrokdecode-2454527da4eeb27683f64ffdc3311d4ac00b3a04.tar.gz
libsigrokdecode-2454527da4eeb27683f64ffdc3311d4ac00b3a04.zip
sigrokdecode_init: Add more Python search paths.
Diffstat (limited to 'decode.c')
-rw-r--r--decode.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/decode.c b/decode.c
index d489068..ab412f6 100644
--- a/decode.c
+++ b/decode.c
@@ -31,13 +31,14 @@ int sigrokdecode_init(void)
/* Py_Initialize() returns void and usually cannot fail. */
Py_Initialize();
- /* FIXME */
- /* Allows for ./gui/sigrok-gui in the top-level directory. */
- PySys_SetPath("libsigrokdecode/scripts");
- /* Allows for ./sigrok-gui in the gui/ directory. */
- // PySys_SetPath("../libsigrokdecode/scripts");
- /* Allows for sigrok-gui from anywhere given sigrok is installed. */
- // PySys_SetPath("/usr/local/share/sigrok");
+ /* Add some more search directories for convenience. */
+ /* FIXME: Check error code. */
+ PyRun_SimpleString(
+ "import sys;"
+ "sys.path.append('libsigrokdecode/scripts');"
+ "sys.path.append('../libsigrokdecode/scripts');"
+ "sys.path.append('/usr/local/share/sigrok');"
+ );
return 0;
}
@@ -71,8 +72,8 @@ int sigrokdecode_run_decoder(const char *decodername, uint8_t *inbuf,
uint64_t inbuflen, uint8_t **outbuf,
uint64_t *outbuflen)
{
- // const char *decoder_filename = "transitioncounter"; /* FIXME */
- const char *decoder_filename = "i2c"; /* FIXME */
+ const char *decoder_filename = "transitioncounter"; /* FIXME */
+ // const char *decoder_filename = "i2c"; /* FIXME */
PyObject *py_name, *py_module, *py_func, *py_args;
PyObject *py_value, *py_result;
int ret;