#include <stdint.h>
#include <stddef.h>
#include <ulib.h>

void dev_ls(void) {
  size_t ndevs = dev_listsize();
  uprintf("TOTAL: %zu\n", ndevs);

  uprintf("%-40s %-10s\n", "DEVICE", "FUNCTIONS");

  for (size_t i = 0; i < 0x100; i++) {
    DevStat devstat; ZERO(&devstat);
    dev_stat(&devstat, i);

    if (!devstat.present)
      continue;

    uprintf("%-40s %-10zu\n", devstat.name, devstat.nfns);
  }
}
