1 (edited by johnbizios 2019-05-31 15:08:00)

Topic: GetSerialNumber on Mac throws an exception...

Hi all -

The following code:

var devices = DeviceList.Local.GetHidDevices(4271).ToList();
var serialNumber = devices[0].GetSerialNumber();

Throws a DeviceIoException  ("Serial Number Not Found") on MacOS (Sierra), but works fine on Windows 10 (.Net Core) using the same device.

Is this a known issue?   Are there any suggested work arounds?

Thanks in advance!

2

Re: GetSerialNumber on Mac throws an exception...

Are the device lists the same on both OSes for that Vendor ID, or is devices[0] referring to something that doesn't show up on Windows, perhaps?
I use serial numbers across all platforms all of the time. It should work.

3 (edited by johnbizios 2019-06-01 19:14:46)

Re: GetSerialNumber on Mac throws an exception...

Hi -

Thanks for the reply.

There is only one device for that Vendor Id.

When I do a device[0].ToString() I get:

Windows: Vertiv Co  Liebert PST5   1803900289A4A1C (VID 4271, PID 2, version 0.2)
Mac OS:   Vertiv Co  Liebert PST5   (no serial number) (Vid 4271, PID 2, version 0.2)

The device path is different which I would expect, but don't understand the elements in the path, but perhaps you might:

Windows: \\\\?\\hid#vid_10af&pid_0002#6&6405ec&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Mac OS:  IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS02@14200000/Liebert PST5  @14200000/IOUSBHostInterface@0/IOUSBHostHIDDevice@14200000,0

I'm running Nuget HID Sharp 2.1.0. 

Everything else is running correctly.  I'm able to get Get Reports and all the data looks is correct on both platforms, so I know that I'm communicating with the device.

... john ...

4

Re: GetSerialNumber on Mac throws an exception...

Hi again -

Still having the issue with the GetSerialNumber() call on Mac OS.  I built the latest source locally on the Mac to try and step through it, but didn't get very far.  The call:

d._serialNumber = NativeMethods.IORegistryEntryGetCFProperty_String(service, NativeMethods.kIOHIDSerialNumberKey)

returns NULL.

The Windows version for the same device works fine.   

Would appreciate any ideas or thoughts that I could try...the Serial Number is vital for my project.

Many thanks!