Skip to content

Commit 315ac11

Browse files
committed
Additional DeviceManager logging
1 parent 1760058 commit 315ac11

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Source/TTController.Service/Manager/DeviceManager.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,26 @@ public DeviceManager()
3636
{
3737
Logger.Debug("Searching for \"{0}\" controllers", definition.Name);
3838
var detectedDevices = HidDevices.Enumerate(definition.VendorId, definition.ProductIds.ToArray());
39+
var detectedCount = detectedDevices.Count();
40+
41+
if (detectedCount == 0)
42+
continue;
43+
44+
if(detectedCount == 1)
45+
Logger.Trace("Found 1 controller [{vid}, {pid}]", definition.VendorId, detectedDevices.Select(d => d.Attributes.ProductId).First());
46+
else
47+
Logger.Trace("Found {count} controllers [{vid}, [{pids}]]", detectedCount, definition.VendorId, detectedDevices.Select(d => d.Attributes.ProductId));
48+
3949
foreach (var device in detectedDevices)
4050
{
4151
var controller = (IControllerProxy) Activator.CreateInstance(definition.ControllerProxyType, new HidDeviceProxy(device), definition);
42-
if(!controller.Init())
52+
if (!controller.Init())
53+
{
54+
Logger.Warn("Failed to initialize \"{0}\" controller! [{1}, {2}]", definition.Name, device.Attributes.VendorHexId, device.Attributes.ProductHexId);
4355
continue;
56+
}
4457

45-
Logger.Info("Found \"{0}\" controller [{1}, {2}]", definition.Name, device.Attributes.VendorHexId, device.Attributes.ProductHexId);
58+
Logger.Info("Initialized \"{0}\" controller [{1}, {2}]", definition.Name, device.Attributes.VendorHexId, device.Attributes.ProductHexId);
4659

4760
devices.Add(device);
4861
controllers.Add(controller);

0 commit comments

Comments
 (0)