ufrisk / LeechCore

LeechCore - Physical Memory Acquisition Library & The LeechAgent Remote Memory Acquisition Agent
GNU General Public License v3.0
517 stars 92 forks source link

How to prevent FPGA devindex from changing? #43

Open lingdianvision opened 2 months ago

lingdianvision commented 2 months ago

I have four FPGA devices on one PC and I realized that devindex is not constant. devindex=0 for the FPGA on PC A. Next time I turn on the PC, I may need devindex=1 to properly turn on the FPGA on PC A. How can I solve this problem? Is there any way to determine what the devindex is on PC A?

ufrisk commented 2 months ago

Currently there is no good way. I mean you can probably start MemProcFS and read the computer name via the API from \sys\computername.txt (https://github.com/ufrisk/MemProcFS/wiki/FS_SysInfo) but that solution isn't very nice.

The FTDI supports addressing via serial number as well, but I haven't added it so I'd have to add it to make it more stable I guess.

Please let me know if the reading of the computer name would be sufficient. If it's the wrong computer you could shut down and read from the other device...

lingdianvision commented 2 months ago

Thank you very much for your reply. Your plan can solve my problem. But I still need to write a part of the code to implement. I hope that in the future, a PCNAME parameter can be added to the VMM.DLL Initialize function, which can be correctly connected to the correct FPGA device each time. "-Device", "fpga: // pcname = pc_001" "-Device", "fpga: // pcname = pc_002" ...........

lingdianvision commented 2 months ago

I also found a problem where, when opening devices with devindex=0 and devindex=1, if the computer that the device devindex=0 is on is shut down or loses power, the VMM_HANDLE obtained by opening the device devindex=1 will become invalid and no longer work.