Skip to content

Commit

Permalink
display names of active drivers on web page
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Aug 12, 2022
1 parent 7e9b31f commit 97f873f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/driver/drv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void DRV_Generic_Init() {

}
void DRV_AppendInformationToHTTPIndexPage(http_request_t *request) {
int i;
int i, j;
int c_active = 0;

if(DRV_Mutex_Take(100)==false) {
Expand All @@ -207,7 +207,25 @@ void DRV_AppendInformationToHTTPIndexPage(http_request_t *request) {
}
DRV_Mutex_Free();

hprintf128(request,"<h5>%i drivers active, total %i</h5>",c_active,g_numDrivers);
hprintf128(request,"<h5>%i drivers active",c_active);
if(c_active>0){
j = 0;// printed 0 names so far
// generate active drivers list in ( )
hprintf128(request," (");
for(i = 0; i < g_numDrivers; i++) {
if(g_drivers[i].bLoaded){
// if at least one name printed, add separator
if(j != 0) {
hprintf128(request,",");
}
hprintf128(request,g_drivers[i].name);
// one more name printed
j++;
}
}
hprintf128(request,")");
}
hprintf128(request,", total %i</h5>",g_numDrivers);
}


0 comments on commit 97f873f

Please sign in to comment.