mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 21:49:07 +08:00
Linux: fixed registration of a class of device
Previously it created 4 instances instead of the next available slot. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
f0312d2da0
commit
400b9ebc20
@ -108,6 +108,7 @@ VDev::register_class_devname(const char *class_devname)
|
||||
char name[32];
|
||||
snprintf(name, sizeof(name), "%s%d", class_devname, class_instance);
|
||||
ret = register_driver(name, (void *)this);
|
||||
if (ret == OK) break;
|
||||
class_instance++;
|
||||
}
|
||||
|
||||
@ -171,6 +172,7 @@ VDev::unregister_class_devname(const char *class_devname, unsigned class_instanc
|
||||
for (int i=0;i<PX4_MAX_DEV; ++i) {
|
||||
if (devmap[i] && strcmp(devmap[i]->name,name) == 0) {
|
||||
delete devmap[i];
|
||||
debug("Unregistered class DEV %s", name);
|
||||
devmap[i] = NULL;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user