Skip to content

Commit f5f9be4

Browse files
author
Mario Sanchez Prada
committed
openprinting: Use 'i386' as architecture when running in 32bit mode
Do this to try to query for the right driver from Openprinting, regardless of the kernel and user-space not matching the effective architecture, falling back to Python's platform.machine() in case of error. https://phabricator.endlessm.com/T10803
1 parent 4f9d92a commit f5f9be4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cupshelpers/openprinting.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,19 @@ def parse_result (status, data, result):
378378
if isinstance(model, Device):
379379
model = model.id
380380

381+
architecture = platform.machine()
382+
383+
# On Intel, we could be running a 32bit user space with a 64bit kernel, in
384+
# which case platform.machine() will return x86_64, leading to downloading
385+
# the wrong printer driver, so we make sure we ask for i386 in that case.
386+
if architecture == 'x86_64' and platform.architecture()[0] == '32bit':
387+
architecture = 'i386'
388+
381389
params = { 'type': 'drivers',
382390
'moreinfo': '1',
383391
'showprinterid': '1',
384392
'onlynewestdriverpackages': '1',
385-
'architectures': platform.machine(),
393+
'architectures': architecture,
386394
'noobsoletes': '1',
387395
'onlyfree': str (self.onlyfree),
388396
'onlymanufacturer': str (self.onlymanufacturer),

0 commit comments

Comments
 (0)