USB: fix debug builds on linux by switching to devcon

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-04 17:58:16 +01:00 committed by refractionpcsx2
parent ede7fa86fa
commit 73ca53eadc
5 changed files with 35 additions and 35 deletions

View File

@ -101,7 +101,7 @@ bool LoadSettingValue(const TSTDSTRING& ini, const TSTDSTRING& section, const TC
#endif #endif
catch (std::exception& err) catch (std::exception& err)
{ {
OSDebugOut(TEXT("%" SFMTs "\n"), err.what()); DevCon.WriteLn("%s\n", err.what());
} }
} }
return false; return false;
@ -161,7 +161,7 @@ void SaveConfig()
OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str()); OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str());
#else #else
bool ret = ciniFile.Save(str_to_wstr(IniPath)); bool ret = ciniFile.Save(str_to_wstr(IniPath));
OSDebugOut(_T("ciniFile.Save: %d [%s]\n"), ret, IniPath.c_str()); DevCon.WriteLn("ciniFile.Save: %d [%s]\n", ret, IniPath.c_str());
#endif #endif
} }
@ -203,7 +203,7 @@ void LoadConfig()
if (dev) if (dev)
{ {
OSDebugOut(_T("Checking device '%" SFMTs "' api: '%" SFMTs "'...\n"), conf.Port[i].c_str(), api.c_str()); DevCon.WriteLn("Checking device '%s' api: '%s'...\n", conf.Port[i].c_str(), api.c_str());
if (!dev->IsValidAPI(api)) if (!dev->IsValidAPI(api))
{ {
api = "<invalid>"; api = "<invalid>";
@ -211,10 +211,10 @@ void LoadConfig()
if (!apis.empty()) if (!apis.empty())
api = *apis.begin(); api = *apis.begin();
OSDebugOut(_T("Invalid! Defaulting to '%" SFMTs "'\n"), api.c_str()); DevCon.WriteLn("Invalid! Defaulting to '%s'\n", api.c_str());
} }
else else
OSDebugOut(_T("API OK\n")); DevCon.WriteLn("API OK\n");
} }
if (api.size()) if (api.size())

View File

@ -95,7 +95,7 @@ bool LoadSetting(const char* dev_type, int port, const std::string& key, const T
bool ret = false; bool ret = false;
if (key.empty()) if (key.empty())
{ {
OSDebugOut(_T("Key is empty for '%s' on port %d\n"), name, port); DevCon.WriteLn("Key is empty for '%s' on port %d\n", name, port);
return false; return false;
} }
@ -108,7 +108,7 @@ bool LoadSetting(const char* dev_type, int port, const std::string& key, const T
section << tkey << _T(" ") << port; section << tkey << _T(" ") << port;
TSTDSTRING str = section.str(); TSTDSTRING str = section.str();
OSDebugOut("[%s] '%s'=", str.c_str(), name); DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);
ret = LoadSettingValue(IniPath, str, name, var); ret = LoadSettingValue(IniPath, str, name, var);
if (ret) if (ret)
OSDebugOutStream_noprfx(var); OSDebugOutStream_noprfx(var);
@ -121,7 +121,7 @@ template <typename Type>
bool LoadSetting(const TCHAR* section, const TCHAR* key, Type& var) bool LoadSetting(const TCHAR* section, const TCHAR* key, Type& var)
{ {
bool ret = false; bool ret = false;
OSDebugOut("[%s] '%s'=", section, key); DevCon.WriteLn("[%s] '%s'=", section, key);
ret = LoadSettingValue(IniPath, section, key, var); ret = LoadSettingValue(IniPath, section, key, var);
if (ret) if (ret)
OSDebugOutStream_noprfx(var); OSDebugOutStream_noprfx(var);
@ -150,7 +150,7 @@ bool SaveSetting(const char* dev_type, int port, const std::string& key, const T
bool ret = false; bool ret = false;
if (key.empty()) if (key.empty())
{ {
OSDebugOut(_T("Key is empty for '%s' on port %d\n"), name, port); DevCon.WriteLn("Key is empty for '%s' on port %d\n", name, port);
return false; return false;
} }
@ -163,7 +163,7 @@ bool SaveSetting(const char* dev_type, int port, const std::string& key, const T
section << tkey << _T(" ") << port; section << tkey << _T(" ") << port;
TSTDSTRING str = section.str(); TSTDSTRING str = section.str();
OSDebugOut(_T("[%s] '%s'="), str.c_str(), name); DevCon.WriteLn("[%s] '%s'=", str.c_str(), name);
ret = SaveSettingValue(IniPath, str, name, var); ret = SaveSettingValue(IniPath, str, name, var);
OSDebugOutStream_noprfx(var); OSDebugOutStream_noprfx(var);
@ -174,7 +174,7 @@ template <typename Type>
bool SaveSetting(const TCHAR* section, const TCHAR* key, const Type var) bool SaveSetting(const TCHAR* section, const TCHAR* key, const Type var)
{ {
bool ret = false; bool ret = false;
OSDebugOut(_T("[%s] '%s'="), section, key); DevCon.WriteLn("[%s] '%s'=", section, key);
ret = SaveSettingValue(IniPath, section, key, var); ret = SaveSettingValue(IniPath, section, key, var);
OSDebugOutStream_noprfx(var); OSDebugOutStream_noprfx(var);

View File

@ -60,7 +60,7 @@ static void wheeltypeChanged(GtkComboBox* widget, gpointer data)
uint8_t port = MIN(reinterpret_cast<uintptr_t>(data), 1); uint8_t port = MIN(reinterpret_cast<uintptr_t>(data), 1);
conf.WheelType[port] = idx; conf.WheelType[port] = idx;
OSDebugOut("Selected wheel type, port %d idx: %d\n", port, idx); DevCon.WriteLn("Selected wheel type, port %d idx: %d\n", port, idx);
} }
} }
@ -85,7 +85,7 @@ static void populateApiWidget(SettingsCB* settingsCB, const std::string& device)
else else
api = it->second; api = it->second;
OSDebugOut("Current api: %s\n", api.c_str()); DevCon.WriteLn("Current api: %s\n", api.c_str());
settingsCB->api = api; settingsCB->api = api;
int i = 0; int i = 0;
for (auto& it : dev->ListAPIs()) for (auto& it : dev->ListAPIs())
@ -119,7 +119,7 @@ static void deviceChanged(GtkComboBox* widget, gpointer data)
else else
conf.Port[0] = s; conf.Port[0] = s;
OSDebugOut("Selected player %d idx: %d [%s]\n", player, active, s.c_str()); DevCon.WriteLn("Selected player %d idx: %d [%s]\n", player, active, s.c_str());
} }
static void apiChanged(GtkComboBox* widget, gpointer data) static void apiChanged(GtkComboBox* widget, gpointer data)
@ -147,7 +147,7 @@ static void apiChanged(GtkComboBox* widget, gpointer data)
changedAPIs[pair] = *it; changedAPIs[pair] = *it;
settingsCB->api = *it; settingsCB->api = *it;
OSDebugOut("selected api: %s\n", it->c_str()); DevCon.WriteLn("selected api: %s\n", it->c_str());
} }
} }
} }
@ -162,12 +162,12 @@ static void configureApi(GtkWidget* widget, gpointer data)
auto& api = settingsCB->api; auto& api = settingsCB->api;
auto dev = RegisterDevice::instance().Device(name); auto dev = RegisterDevice::instance().Device(name);
OSDebugOut("configure api %s [%s] for player %d\n", api.c_str(), name.c_str(), player); DevCon.WriteLn("configure api %s [%s] for player %d\n", api.c_str(), name.c_str(), player);
if (dev) if (dev)
{ {
GtkWidget* dlg = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "dlg")); GtkWidget* dlg = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "dlg"));
int res = dev->Configure(port, api, dlg); int res = dev->Configure(port, api, dlg);
OSDebugOut("Configure returned %d\n", res); DevCon.WriteLn("Configure returned %d\n", res);
} }
} }
@ -252,7 +252,7 @@ void USBconfigure()
auto deviceProxy = RegisterDevice::instance().Device(device); auto deviceProxy = RegisterDevice::instance().Device(device);
if (!deviceProxy) if (!deviceProxy)
{ {
OSDebugOut(_T("Device '%" SFMTs "' is registered, but failed to get proxy!\n"), device.c_str()); DevCon.WriteLn("Device '%s' is registered, but failed to get proxy!\n"), device.c_str();
continue; continue;
} }
auto name = deviceProxy->Name(); auto name = deviceProxy->Name();

View File

@ -557,7 +557,7 @@ namespace usb_hid
HIDState* hs = &us->f.hid; HIDState* hs = &us->f.hid;
int ret; int ret;
OSDebugOut(TEXT("usb-hid: req %04X val: %04X idx: %04X len: %d\n"), request, value, index, length); DevCon.WriteLn("usb-hid: req %04X val: %04X idx: %04X len: %d\n", request, value, index, length);
ret = usb_desc_handle_control(dev, p, request, value, index, length, data); ret = usb_desc_handle_control(dev, p, request, value, index, length, data);
if (ret >= 0) if (ret >= 0)
{ {
@ -642,7 +642,7 @@ namespace usb_hid
break; break;
case SET_IDLE: case SET_IDLE:
hs->idle = (uint8_t)(value >> 8); hs->idle = (uint8_t)(value >> 8);
OSDebugOut(TEXT("IDLE %d\n"), hs->idle); DevCon.WriteLn("IDLE %d\n", hs->idle);
hid_set_next_idle(hs); hid_set_next_idle(hs);
if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET) if (hs->kind == HID_MOUSE || hs->kind == HID_TABLET)
{ {
@ -897,7 +897,7 @@ namespace usb_hid
USBDevice* BeatManiaDevice::CreateDevice(int port) USBDevice* BeatManiaDevice::CreateDevice(int port)
{ {
OSDebugOut(_T("%s\n"), __func__); DevCon.WriteLn("%s\n", __func__);
UsbHIDState* s; UsbHIDState* s;
std::string varApi; std::string varApi;

View File

@ -91,7 +91,7 @@ namespace usb_pad
void SetAutoCenter(FFDevice* ffdev, const autocenter& effect) void SetAutoCenter(FFDevice* ffdev, const autocenter& effect)
{ {
OSDebugOut(_T("%s: k1 %d k2 %d clip %d\n"), __func__, effect.k1, effect.k2, effect.clip); DevCon.WriteLn("%s: k1 %d k2 %d clip %d\n", __func__, effect.k1, effect.k2, effect.clip);
ffdev->SetAutoCenter((effect.k1 * effect.clip / 255) * 100 / 255); // FIXME ffdev->SetAutoCenter((effect.k1 * effect.clip / 255) * 100 / 255); // FIXME
} }
@ -103,7 +103,7 @@ namespace usb_pad
static int warned = 0; static int warned = 0;
int caps = 0; int caps = 0;
OSDebugOut(TEXT("FFB %02X, %02X, %02X, %02X : %02X, %02X, %02X, %02X\n"), DevCon.WriteLn("FFB %02X, %02X, %02X, %02X : %02X, %02X, %02X, %02X\n",
ffdata->cmdslot, ffdata->type, ffdata->u.params[0], ffdata->u.params[1], ffdata->cmdslot, ffdata->type, ffdata->u.params[0], ffdata->u.params[1],
ffdata->u.params[2], ffdata->u.params[3], ffdata->u.params[4], ffdata->padd0); ffdata->u.params[2], ffdata->u.params[3], ffdata->u.params[4], ffdata->padd0);
@ -173,7 +173,7 @@ namespace usb_pad
{ {
if (warned == 0) if (warned == 0)
{ {
OSDebugOut("variable force cannot be converted to constant force (l1=%hhu, t1=%hhu, s1=%hhu, d1=%hhu\n", DevCon.WriteLn("variable force cannot be converted to constant force (l1=%hhu, t1=%hhu, s1=%hhu, d1=%hhu\n",
ffdata->u.variable.l1, ffdata->u.variable.t1, ffdata->u.variable.s1, ffdata->u.variable.d1); ffdata->u.variable.l1, ffdata->u.variable.t1, ffdata->u.variable.s1, ffdata->u.variable.d1);
warned = 1; warned = 1;
} }
@ -189,7 +189,7 @@ namespace usb_pad
{ {
if (warned == 0) if (warned == 0)
{ {
OSDebugOut("variable force cannot be converted to constant force (l2=%hhu, t2=%hhu, s2=%hhu, d2=%hhu\n", DevCon.WriteLn("variable force cannot be converted to constant force (l2=%hhu, t2=%hhu, s2=%hhu, d2=%hhu\n",
ffdata->u.variable.l2, ffdata->u.variable.t2, ffdata->u.variable.s2, ffdata->u.variable.d2); ffdata->u.variable.l2, ffdata->u.variable.t2, ffdata->u.variable.s2, ffdata->u.variable.d2);
warned = 1; warned = 1;
} }
@ -216,7 +216,7 @@ namespace usb_pad
SetAutoCenter(mFFdev, ffdata->u.autocenter); SetAutoCenter(mFFdev, ffdata->u.autocenter);
break; break;
default: default:
OSDebugOut(TEXT("CMD_DOWNLOAD_AND_PLAY: unhandled force type 0x%02X in slots 0x%02X\n"), ffdata->type, slots); DevCon.WriteLn("CMD_DOWNLOAD_AND_PLAY: unhandled force type 0x%02X in slots 0x%02X\n", ffdata->type, slots);
break; break;
} }
} }
@ -251,7 +251,7 @@ namespace usb_pad
mFFdev->DisableForce(EFF_DAMPER); mFFdev->DisableForce(EFF_DAMPER);
break; break;
default: default:
OSDebugOut(TEXT("CMD_STOP: unhandled force type 0x%02X in slot 0x%02X\n"), ffdata->type, slots); DevCon.WriteLn("CMD_STOP: unhandled force type 0x%02X in slot 0x%02X\n", ffdata->type, slots);
break; break;
} }
} }
@ -259,7 +259,7 @@ namespace usb_pad
} }
break; break;
case CMD_DEFAULT_SPRING_ON: //0x04 case CMD_DEFAULT_SPRING_ON: //0x04
OSDebugOut(TEXT("CMD_DEFAULT_SPRING_ON: unhandled cmd\n")); DevCon.WriteLn("CMD_DEFAULT_SPRING_ON: unhandled cmd\n");
break; break;
case CMD_DEFAULT_SPRING_OFF: //0x05 case CMD_DEFAULT_SPRING_OFF: //0x05
{ {
@ -270,24 +270,24 @@ namespace usb_pad
} }
else else
{ {
OSDebugOut(TEXT("CMD_DEFAULT_SPRING_OFF: unhandled slots 0x%02X\n"), slots); DevCon.WriteLn("CMD_DEFAULT_SPRING_OFF: unhandled slots 0x%02X\n", slots);
} }
} }
break; break;
case CMD_NORMAL_MODE: //0x08 case CMD_NORMAL_MODE: //0x08
OSDebugOut(TEXT("CMD_NORMAL_MODE: unhandled cmd\n")); DevCon.WriteLn("CMD_NORMAL_MODE: unhandled cmd\n");
break; break;
case CMD_SET_LED: //0x09 case CMD_SET_LED: //0x09
OSDebugOut(TEXT("CMD_SET_LED: unhandled cmd\n")); DevCon.WriteLn("CMD_SET_LED: unhandled cmd\n");
break; break;
case CMD_RAW_MODE: //0x0B case CMD_RAW_MODE: //0x0B
OSDebugOut(TEXT("CMD_RAW_MODE: unhandled cmd\n")); DevCon.WriteLn("CMD_RAW_MODE: unhandled cmd\n");
break; break;
case CMD_SET_DEFAULT_SPRING: //0x0E case CMD_SET_DEFAULT_SPRING: //0x0E
OSDebugOut(TEXT("CMD_SET_DEFAULT_SPRING: unhandled cmd\n")); DevCon.WriteLn("CMD_SET_DEFAULT_SPRING: unhandled cmd\n");
break; break;
case CMD_SET_DEAD_BAND: //0x0F case CMD_SET_DEAD_BAND: //0x0F
OSDebugOut(TEXT("CMD_SET_DEAD_BAND: unhandled cmd\n")); DevCon.WriteLn("CMD_SET_DEAD_BAND: unhandled cmd\n");
break; break;
} }
} }
@ -302,7 +302,7 @@ namespace usb_pad
if (ffdata->type == EXT_CMD_WHEEL_RANGE_200_DEGREES) if (ffdata->type == EXT_CMD_WHEEL_RANGE_200_DEGREES)
{ {
} }
OSDebugOut(TEXT("CMD_EXTENDED: unhandled cmd 0x%02X%02X%02X\n"), DevCon.WriteLn("CMD_EXTENDED: unhandled cmd 0x%02X%02X%02X\n",
ffdata->type, ffdata->u.params[0], ffdata->u.params[1]); ffdata->type, ffdata->u.params[0], ffdata->u.params[1]);
} }
} }