1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-22 07:18:52 -05:00

Verbosity

This commit is contained in:
Raphael Assenat 2015-10-24 22:07:21 -04:00
parent 85257807f5
commit 54a8b19350

View File

@ -135,8 +135,9 @@ gcn64_hdl_t gcn64_openDevice(struct gcn64_info *dev)
} }
hdev = hid_open_path(dev->str_path); hdev = hid_open_path(dev->str_path);
if (!hdev) if (!hdev) {
return NULL; return NULL;
}
return hdev; return hdev;
} }
@ -147,6 +148,7 @@ gcn64_hdl_t gcn64_openBy(struct gcn64_info *dev, unsigned char flags)
struct gcn64_info inf; struct gcn64_info inf;
gcn64_hdl_t h; gcn64_hdl_t h;
if (IS_VERBOSE())
printf("gcn64_openBy, flags=0x%02x\n", flags); printf("gcn64_openBy, flags=0x%02x\n", flags);
ctx = gcn64_allocListCtx(); ctx = gcn64_allocListCtx();
@ -154,7 +156,9 @@ gcn64_hdl_t gcn64_openBy(struct gcn64_info *dev, unsigned char flags)
return NULL; return NULL;
while (gcn64_listDevices(&inf, ctx)) { while (gcn64_listDevices(&inf, ctx)) {
if (IS_VERBOSE())
printf("Considering '%s'\n", inf.str_path); printf("Considering '%s'\n", inf.str_path);
if (flags & GCN64_FLG_OPEN_BY_SERIAL) { if (flags & GCN64_FLG_OPEN_BY_SERIAL) {
if (wcscmp(inf.str_serial, dev->str_serial)) if (wcscmp(inf.str_serial, dev->str_serial))
continue; continue;
@ -175,7 +179,9 @@ gcn64_hdl_t gcn64_openBy(struct gcn64_info *dev, unsigned char flags)
continue; continue;
} }
if (IS_VERBOSE())
printf("Found device. opening...\n"); printf("Found device. opening...\n");
h = gcn64_openDevice(&inf); h = gcn64_openDevice(&inf);
gcn64_freeListCtx(ctx); gcn64_freeListCtx(ctx);
return h; return h;
@ -188,6 +194,7 @@ gcn64_hdl_t gcn64_openBy(struct gcn64_info *dev, unsigned char flags)
void gcn64_closeDevice(gcn64_hdl_t hdl) void gcn64_closeDevice(gcn64_hdl_t hdl)
{ {
hid_device *hdev = (hid_device*)hdl; hid_device *hdev = (hid_device*)hdl;
if (hdev) { if (hdev) {
hid_close(hdev); hid_close(hdev);
} }