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

line 116: 16#0:: syntax error in expression (error token is ":") #59

Closed
woodspire opened this issue Feb 24, 2021 · 6 comments · Fixed by #68
Closed

line 116: 16#0:: syntax error in expression (error token is ":") #59

woodspire opened this issue Feb 24, 2021 · 6 comments · Fixed by #68

Comments

@woodspire
Copy link

Brand new install of Ubuntu 20.10

Laptop: HP Spectre x360 13 aw-2020ca
Intel Xe graphics
16 GB RAM
thunderbolt 4
Razer Core X
Nvidia GeForce 1060

@woodspire
Copy link
Author

lspci -d ::0300 && lspci -d ::0302
0000:00:02.0 VGA compatible controller: Intel Corporation UHD Graphics (rev 01)
0000:03:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)

@woodspire woodspire changed the title usr/bin/egpu-switcher: line 116: 16#0:: syntax error in expression (error token is ":") line 116: 16#0:: syntax error in expression (error token is ":") Feb 24, 2021
@woodspire
Copy link
Author

quick hack:

declare name=$(echo $line | grep -o -e "[^:]$")
declare bus=$(echo $line | grep -o -e "^[^ ]
")

hack here

bus=${bus:2}

The bus IDs in hex

declare bus1h=${bus:0:2}
declare bus2h=${bus:3:2}
declare bus3h=${bus:6:1}

@hertg
Copy link
Owner

hertg commented Feb 25, 2021

lspci -d ::0300 && lspci -d ::0302
0000:00:02.0 VGA compatible controller: Intel Corporation UHD Graphics (rev 01)
0000:03:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)

quick question, does it print out the domain 0000 on your system?
Heres the output of the exact same command on my laptop:

00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
09:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1080] (rev a1)

If so, what version is your installed pciutils? I'm on 3.7.0-1.

@firleaf
Copy link

firleaf commented Jul 10, 2021

I'm on Fedora 34, pciutils 3.7.0-3 and my lspci -d ::0300 && lspci -d ::0302 output is:

0000:00:02.0 VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)
0000:3b:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)

So 0000 for me as well. I've done a little research, and the linux man page suggests using lspci -mm for script use.

lspci -mm -d ::0300 && lspci -mm -d ::0302:

00:02.0 "VGA compatible controller" "Intel Corporation" "TigerLake-LP GT2 [Iris Xe Graphics]" -r01 "Dell" "Device 0991"
3b:00.0 "VGA compatible controller" "NVIDIA Corporation" "GP107 [GeForce GTX 1050 Ti]" -ra1 "ASUSTeK Computer Inc." "Device 85d3"

This looks correct to me, and I believe this should work on any other distro too. So I'll go ahead and submit a pull request with the change.

@firleaf
Copy link

firleaf commented Jul 10, 2021

I should have read the whole man page. lspci, by default, suppresses domain numbers if the machine only has the domain 0. By using the flag -D the PCI domain numbers will always be shown. I will implement this rather than -mm as it will require smaller changes in your code.

@hertg
Copy link
Owner

hertg commented Jul 11, 2021

Nice, thanks for investigating this issue!
Using the -D option makes sense.

But there is still an issue now if the video card is on a non-zero domain, because the domain part is simply ignored right now.

To fix that, we have to store the domain and put it in the BusID option in xorg.conf.
Here is the relevant paragraph from the manpage (man xorg.conf):

BusID  "bus-id"
        This specifies the bus location of the graphics card.  For PCI/AGP cards,  the  bus-id
        string  has  the form PCI:bus@domain:device:function (e.g., "PCI:1@0:0:0" might be ap-
        propriate for an AGP card). The "@domain" part can be left out for PCI domain 0.  This
        field  is usually optional in single-head configurations when using the primary graph-
        ics card.  In multi-head configurations, or when using a secondary graphics card in  a
        single-head  configuration,  this  entry is mandatory.  Its main purpose is to make an
        unambiguous connection between the device section and the hardware it is representing.
        This information can usually be found by running the pciaccess tool scanpci.

So we probably need to add the @domain part in the xorg.conf.

That being said, I'll merge your PR, because it already resolves the issue to some degree. The problem with video-cards on a non-zero domain can be addressed later, I'll open a new issue for that. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants