Thanks to Scott for showing me a device with those symptoms.
(it's a server using desktop Ubuntu image)
Current situation
-----------------
$ ./graphics_card_resource -c ./udev_resource
Traceback (most recent call last):
File "./graphics_card_resource", line 168, in <module>
raise SystemExit(main())
File "./graphics_card_resource", line 122, in main
video_devices.sort(key=lambda r: bus_ordering(r))
File "./graphics_card_resource", line 122, in <lambda>
video_devices.sort(key=lambda r: bus_ordering(r))
File "./graphics_card_resource", line 97, in bus_ordering
return int(record.get('path').split(':')[-2])
ValueError: invalid literal for int() with base 10: 'b3'
Root cause
----------
So far, the digit extracted by bus_ordering() had always been a base 10 integer.
However, on servers, the extracted digit looks more like an hexadecimal value (base 16 integer):
/devices/pci0000:b2/0000:b2:00.0/0000:b3:00.0
Solution
--------
In /usr/lib/plainbox-provider-resource-generic/bin/graphics_card_resource, line 96, replace:
Thanks to Scott for showing me a device with those symptoms.
(it's a server using desktop Ubuntu image)
Current situation
-----------------
$ ./graphics_ card_resource -c ./udev_resource card_resource" , line 168, in <module> card_resource" , line 122, in main devices. sort(key= lambda r: bus_ordering(r)) card_resource" , line 122, in <lambda> devices. sort(key= lambda r: bus_ordering(r)) card_resource" , line 97, in bus_ordering get('path' ).split( ':')[-2] )
Traceback (most recent call last):
File "./graphics_
raise SystemExit(main())
File "./graphics_
video_
File "./graphics_
video_
File "./graphics_
return int(record.
ValueError: invalid literal for int() with base 10: 'b3'
Root cause
----------
So far, the digit extracted by bus_ordering() had always been a base 10 integer.
However, on servers, the extracted digit looks more like an hexadecimal value (base 16 integer):
/devices/ pci0000: b2/0000: b2:00.0/ 0000:b3: 00.0
Solution
--------
In /usr/lib/ plainbox- provider- resource- generic/ bin/graphics_ card_resource, line 96, replace:
return int(record. get('path' ).split( ':')[-2] )
with:
return int(record. get('path' ).split( ':')[-2] , 16)
Result
------
$ ./graphics_ card_resource -c ./udev_resource pci0000: b2/0000: b2:00.0/ 0000:b3: 00.0
bus: pci
category: VIDEO
driver: nvidia
index: 1
path: /devices/
prime_gpu_offload: Off
product: PCI ID 0x1cb1
product_id: 7345
product_slug: PCI_ID_0x1cb1
subproduct_id: 4540
subvendor_id: 4136
vendor: NVIDIA Corporation
vendor_id: 4318
vendor_slug: NVIDIA_Corporation
This change should not create regression, but it has to be confirmed by testing on a laptop/desktop before pushing to stable.