2- After installing Adb and Fastboot, hold Shift button and right click on anywhere on the screen.
3-You will see:"Open Command Window Here" option on right click menu. Click it and open command.
4-Type and wait to see your cell phone detected. You will see something like this if your device is rooted and all the phone drivers are installed:
5-On this step, please gain an access to root shell with this command:
6-After tapping enters twice, now you have a root access on screen. To activate diag mode and open port 9008, please type
and enter. If you disconnect or type
your diag port will be closed.
7-After opening your diag port, using you can flash ROMs with qfil inside the Qualcomm service tool (qpst) or do some modifications on modem configurations.
However, if you can't even boot (system, recovery, fastboot etc.), here is the solution:
Hold volume up button (volume down to Marshmellow) when a device is closed and plug cell phone into the computer. Your computer will recognize diag com port for a short time. If you can manage to click on the download button on qfil at that time, qfil will hang on that port and flash your system successfully.