mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 03:53:33 +08:00
Use DevMgr::getNextDevicePath()
Also, a fix for number of args passed for accelsim. Updated to newest version of DriverFramework. DF drvices show up now in list_devices Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -550,18 +550,16 @@ void VDev::showDevices()
|
|||||||
pthread_mutex_unlock(&devmutex);
|
pthread_mutex_unlock(&devmutex);
|
||||||
|
|
||||||
PX4_INFO("DF Devices:");
|
PX4_INFO("DF Devices:");
|
||||||
// TODO NOT IMPLEMENTED
|
std::string dev_path, instance_path;
|
||||||
|
|
||||||
std::string devname;
|
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Each look increments index and returns -1 if end reached
|
// Each look increments index and returns -1 if end reached
|
||||||
i = DevMgr::getNextDeviceName(index, devname);
|
i = DevMgr::getNextDevicePath(index, dev_path, instance_path);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
PX4_INFO(" %s", devname.c_str());
|
PX4_INFO(" %s (%s)", dev_path.c_str(), instance_path.c_str());
|
||||||
}
|
}
|
||||||
} while (i == 0);
|
} while (i == 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
Submodule src/lib/DriverFramework updated: a09333b9e4...45878058a7
@@ -496,25 +496,25 @@ transition_result_t hil_state_transition(hil_state_t new_state, orb_advert_t sta
|
|||||||
|
|
||||||
|
|
||||||
// Handle DF devices
|
// Handle DF devices
|
||||||
std::string dfdevname;
|
std::string df_dev_path, df_dev_instance_path;
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (DevMgr::getNextDeviceName(index, dfdevname) < 0) {
|
if (DevMgr::getNextDevicePath(index, df_dev_path, df_dev_instance_path) < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevHandle h;
|
DevHandle h;
|
||||||
DevMgr::getHandle(dfdevname.c_str(), h);
|
DevMgr::getHandle(df_dev_path.c_str(), h);
|
||||||
|
|
||||||
if (!h.isValid()) {
|
if (!h.isValid()) {
|
||||||
warn("failed opening device %s", dfdevname.c_str());
|
warn("failed opening device %s", df_dev_path.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int block_ret = h.ioctl(DEVIOCSPUBBLOCK, 1);
|
int block_ret = h.ioctl(DEVIOCSPUBBLOCK, 1);
|
||||||
DevMgr::releaseHandle(h);
|
DevMgr::releaseHandle(h);
|
||||||
|
|
||||||
printf("Disabling %s: %s\n", dfdevname.c_str(), (block_ret == OK) ? "OK" : "ERROR");
|
printf("Disabling %s: %s\n", df_dev_path.c_str(), (block_ret == OK) ? "OK" : "ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = TRANSITION_CHANGED;
|
ret = TRANSITION_CHANGED;
|
||||||
|
|||||||
@@ -1182,6 +1182,10 @@ accelsim_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc <= 1) {
|
||||||
|
accelsim::usage();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
const char *verb = argv[myoptind];
|
const char *verb = argv[myoptind];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user