Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPC 930 Card Reader Device cannot be inventoried with Windows serial number #650

Open
erique-souza opened this issue Apr 17, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@erique-souza
Copy link

Bug reporting acknowledgment

Yes, I read it

Professional support

Still not applicable

Describe the bug

I'm trying to inventory the USB device Card Reader model PPC 930 from Gertec, in Windows there is the full driver for the device, but the GLPI-Agent when importing only brings this data in the .json file

        {
            "caption": "PPC 920-930 Enumerator Device",
            "manufacturer": "GERTEC Telecomunicacoes Ltda.",
            "name": "PPC 920-930 Enumerator Device",
            "productid": "C902",
            "vendorid": "1753"
        },

The device's serial number is missing, but this information exists in the Windows registry in this path: Computer\HKEY_CURRENT_USER\Software\Gertec\PIN Pad as shown in the print below

image

I would really like to know how GLPI-Agent exactly collects information from device drivers to always try to check the correct path of how the reading should work

To reproduce

  • Have Gertec PPC 930 equipment
  • Connect via USB on Windows
  • Installation of the device's Full Driver
  • Have the GLPI-Agent in its latest version, and import validation in GLPI

Expected behavior

The device inventory along with the computer inventory in the Devices tab linked to the asset

Operating system

Windows

GLPI Agent version

1.7.3

GLPI version

10.0.14

GLPIInventory plugin or other plugin version

GLPI Inventory v1.3.5

Additional context

No response

@erique-souza erique-souza added the bug Something isn't working label Apr 17, 2024
@erique-souza
Copy link
Author

erique-souza commented Apr 17, 2024

Below is the complete .json file for checking
computer_36_36276 (7).json

Also follow my complete glpi-agent log with debug level 2 for debugging
glpi-agent.log

@g-bougard
Copy link
Member

Hi @erique-souza

the relevant file for USB devices inventory on windows is this one: https://github.com/glpi-project/glpi-agent/blob/develop/lib/GLPI/Agent/Task/Inventory/Win32/USB.pm

Actually, it only uses WMI to retrieve connected devices and nothing more is done to find more information like serialnumber if it is not found. You can see what's the agent analyses by running:

wmic path CIM_LogicalDevice get /format:list

From this list, only devices for which DeviceID field matches /^USB\\VID_(\w+)&PID_(\w+)\\(.*)/ regular expression will be recognized as USB devices. And we only try to extract S/N from this ProductID field.

Can you still share at least the entry related to your device ?

To support extracting S/N from registry for some case, dedicated modules will have to be created. My guess is we can use "productid": "C902" & "vendorid": "1753" to trigger the module, maybe just on vendorid like the way this is done for monitor in Screen.pm to trigger modules from lib/GLPI/Agent/Tools/Screen folder. Using this principle could permit users to develop their own module.

Can you share an export of HKEY_CURRENT_USER\Software\Gertec\PIN Pad to eventually use it in tests ?

@erique-souza
Copy link
Author

erique-souza commented Apr 26, 2024

Hi @erique-souza

the relevant file for USB devices inventory on windows is this one: https://github.com/glpi-project/glpi-agent/blob/develop/lib/GLPI/Agent/Task/Inventory/Win32/USB.pm

Actually, it only uses WMI to retrieve connected devices and nothing more is done to find more information like serialnumber if it is not found. You can see what's the agent analyses by running:

wmic path CIM_LogicalDevice get /format:list

From this list, only devices for which DeviceID field matches /^USB\\VID_(\w+)&PID_(\w+)\\(.*)/ regular expression will be recognized as USB devices. And we only try to extract S/N from this ProductID field.

Can you still share at least the entry related to your device ?

To support extracting S/N from registry for some case, dedicated modules will have to be created. My guess is we can use "productid": "C902" & "vendorid": "1753" to trigger the module, maybe just on vendorid like the way this is done for monitor in Screen.pm to trigger modules from lib/GLPI/Agent/Tools/Screen folder. Using this principle could permit users to develop their own module.

Can you share an export of HKEY_CURRENT_USER\Software\Gertec\PIN Pad to eventually use it in tests ?

Understood, I can no longer access the equipment to export the exact record, but I made a replica on my Windows and exported it if I was going to use the data for testing

Gertec test.reg.txt
I renamed the .reg to .txt, just remove the .txt to access the file correctly

image

@g-bougard
Copy link
Member

Okay, the wmic output would have been useful for automatic tests, but I still can guess it from the json output.

I think I can try to develop this support anyway as this could be an interesting update.

@g-bougard
Copy link
Member

Hi @erique-souza

I see a problem in your registry export: it's under HKEY_CURRENT_USER hive... do you have the same keys under HKEY_LOCAL_MACHINE ? This is a problem as the service is running as LocalSystem user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants