1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] error occured when run setpci reading in multithreading

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    when i run below code without remove code, it's ok. but after removed first BDF in a thread there will be a error when reading DSP with setpci in other thread like:

    setpci: Cannot open /sys/bus/pci/devices/bdf/resource: No such file or directory

    I don't konw why this happend since I only removed BDF and all I do with setpci is about DSP.

    def read(dsp,bdf):
    res=os.popen('sudo setpci -s '+dsp+' 0x3e.w').read().strip()
    logging.info(threading.current_thread().name+' :'+res)
    os.system('echo 1 > /sys/bus/pci/devices/'+bdf+'/remove')
    time.sleep(1)
    os.system('echo 1 > /sys/bus/pci/devices/'+dsp+'/rescan')

    for i,bdf in enumerate(bdfs):
    dsp=get_dsp(bdf)
    threading.Thread(target=read,args=(dsp,bdf),name=bdf).start()


    some log:

    0000:0e:00.0 :0003
    setpci: Cannot open /sys/bus/pci/devices/0000:0e:00.0/resource: No such file or directory
    0000:0f:00.0 :

    Continue reading...

Compartilhe esta Página