diff options
author | px4dev <px4@purgatory.org> | 2012-12-29 00:01:04 -0800 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-12-29 00:01:04 -0800 |
commit | 35c82ff2fc63ab823770f9776e6b6a0f81cd4452 (patch) | |
tree | 86956f9f00f1270eafc921748ac024a7daa92f80 /apps/drivers/hil/hil.cpp | |
parent | f0da789626c32695e670b55dab29283eed4a05c6 (diff) | |
download | px4-firmware-35c82ff2fc63ab823770f9776e6b6a0f81cd4452.tar.gz px4-firmware-35c82ff2fc63ab823770f9776e6b6a0f81cd4452.tar.bz2 px4-firmware-35c82ff2fc63ab823770f9776e6b6a0f81cd4452.zip |
Make mixer ioctls load from a memory buffer rather than a file. This is prep for uploading the memory buffer to IO to be processed there.
Diffstat (limited to 'apps/drivers/hil/hil.cpp')
-rw-r--r-- | apps/drivers/hil/hil.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/apps/drivers/hil/hil.cpp b/apps/drivers/hil/hil.cpp index 0780f3bb2..f227db1f7 100644 --- a/apps/drivers/hil/hil.cpp +++ b/apps/drivers/hil/hil.cpp @@ -577,21 +577,19 @@ HIL::pwm_ioctl(file *filp, int cmd, unsigned long arg) break; } - case MIXERIOCLOADFILE: { - const char *path = (const char *)arg; + case MIXERIOCLOADBUF: { + const char *buf = (const char *)arg; + unsigned buflen = strnlen(buf, 1024); - if (_mixers != nullptr) { - delete _mixers; - _mixers = nullptr; - } + if (_mixers == nullptr) + _mixers = new MixerGroup(control_callback, (uintptr_t)&_controls); - _mixers = new MixerGroup(control_callback, (uintptr_t)&_controls); if (_mixers == nullptr) { ret = -ENOMEM; + } else { - debug("loading mixers from %s", path); - ret = _mixers->load_from_file(path); + ret = _mixers->load_from_buf(buf, buflen); if (ret != 0) { debug("mixer load failed with %d", ret); @@ -600,10 +598,10 @@ HIL::pwm_ioctl(file *filp, int cmd, unsigned long arg) ret = -EINVAL; } } - break; } + default: ret = -ENOTTY; break; |