Readme update

Switch to 'setAutoDetachKernelDriver' instead of checking (CAP_SUPPORTS_DETACH_KERNEL_DRIVER) each time.
This commit is contained in:
Dmitry Isaenko 2019-12-10 23:26:43 +03:00
parent 049c07fe8d
commit 9be451e05e
2 changed files with 20 additions and 36 deletions

View file

@ -1,10 +1,11 @@
# NS-USBloader # NS-USBloader
![License](https://img.shields.io/badge/License-GPLv3-blue.svg) [![Releases](https://img.shields.io/github/downloads/developersu/ns-usbloader/total.svg)]() [![LatestVer](https://img.shields.io/github/release/developersu/ns-usbloader.svg)]() ![License](https://img.shields.io/badge/License-GPLv3-blue.svg) ![Releases](https://img.shields.io/github/downloads/developersu/ns-usbloader/total.svg) ![LatestVer](https://img.shields.io/github/release/developersu/ns-usbloader.svg)
[Support author](#support-this-app) [Support author](#support-this-app)
NS-USBloader is a PC-side **[Adubbz/TinFoil](https://github.com/Adubbz/Tinfoil/)** (version 0.2.1; USB and Network) and **GoldLeaf** (USB) NSP installer. Replacement for default **usb_install_pc.py**, **remote_install_pc.py** and **GoldTree**. NS-USBloader is a PC-side installer for **[Adubbz/TinFoil (v0.2.1)](https://github.com/Adubbz/Tinfoil/)**, **[Huntereb/Awoo-Installer](https://github.com/Huntereb/Awoo-Installer)** (USB and Network supported) and **[XorTroll/GoldLeaf](https://github.com/XorTroll/Goldleaf)** (USB) NSP installer.
Replacement for default **usb_install_pc.py**, **remote_install_pc.py**, **GoldTree**/**Quark**.
[Click here for Android version ;)](https://github.com/developersu/ns-usbloader-mobile) [Click here for Android version ;)](https://github.com/developersu/ns-usbloader-mobile)
@ -42,12 +43,18 @@ Sometimes I add new posts about this project [on my home page](https://developer
JRE/JDK 8u60 or higher. JRE/JDK 8u60 or higher.
### Table of supported GoldLeaf versions ### Supported GoldLeaf versions
| GoldLeaf version | NS-USBloader version | | GoldLeaf version | NS-USBloader version |
| ---------------- | -------------------- | | ---------------- | -------------------- |
| v0.5 | v0.4 - v0.5.2, v0.8+ | | v0.5 | v0.4 - v0.5.2, v0.8+ |
| v0.6.1 | v0.6 | | v0.6.1 | v0.6 |
| v0.7 | v0.7 - v0.8+ | | v0.7 - 0.7.3 | v0.7 - v0.8+ |
### Awoo support
Awoo-installer uses the same command-set (or 'protocol') to TinFoil. So just select 'TinFoil' in case you're going to use Awoo.
Also, please go to 'Settings' tab of NS-USBloader after first installation and check 'Allow XCI / NSZ / XCZ files selection for TinFoil' option. This installer can install not only NSPs but a way more formats!
### Usage ### Usage
##### Linux: ##### Linux:
@ -84,14 +91,11 @@ Set 'Security & Privacy' settings if needed.
#### And how to use it? #### And how to use it?
The first thing you should do it install TinFoil ([Adubbz](https://github.com/Adubbz/Tinfoil/)) or GoldLeaf ([XorTroll](https://github.com/XorTroll/Goldleaf)) on your NS. The first thing you should do it install TinFoil ([Adubbz](https://github.com/Adubbz/Tinfoil/)), GoldLeaf ([XorTroll](https://github.com/XorTroll/Goldleaf)) or Awoo ([Huntereb](https://github.com/Huntereb/Awoo-Installer)) on your NS.
Here is the version of 'not perfect but anyway' [tinfoil I use](https://cloud.mail.ru/public/DwbX/H8d2p3aYR). Take a look on app, find where is the option to install from USB and/or Network. Maybe [this article (about TinFoil)](https://developersu.blogspot.com/2019/02/ns-usbloader-en.html) will be helpful.
Ok, I'm almost sure that this version has bugs. I don't remember where I downloaded it. But it works for me somehow.
Let's rephrase, if you have working version of TinFoil **DO NOT** use this one. Ok. let's begin. #### In details
Take a look on app, find where is the option to install from USB and/or Network. Maybe [this article](https://developersu.blogspot.com/2019/02/ns-usbloader-en.html) will be helpful.
There are three tabs. First one is main. There are three tabs. First one is main.
@ -166,9 +170,6 @@ Want to support development? Make a donation* (see below):
* [EN] Please note! This is non-commercial application. Any received money considered as a gift. * [EN] Please note! This is non-commercial application. Any received money considered as a gift.
* [RU] Пожалуйста обратите внимание! Это некоммерческое приложение. Перечисляя средства вы совершаете дарение. * [RU] Пожалуйста обратите внимание! Это некоммерческое приложение. Перечисляя средства вы совершаете дарение.
##### Thanks Thanks
Appreciate assistance and support of both Vitaliy and Konstantin. Without you all this magic would not have happened.
[Konstanin Kelemen](https://github.com/konstantin-kelemen) Appreciate assistance and support of both [Vitaliy](https://github.com/SebastianUA) and [Konstantin](https://github.com/konstantin-kelemen). Without you all this magic would not have happened.
[Vitaliy Natarov](https://github.com/SebastianUA)

View file

@ -91,28 +91,11 @@ class UsbConnect {
LibUsb.freeDeviceList(deviceList, true); LibUsb.freeDeviceList(deviceList, true);
// DO some stuff to connected NS // DO some stuff to connected NS
// Check if this device uses kernel driver and detach if possible: // Actually, there are not drivers in Linux kernel that are using this device..
boolean canDetach = LibUsb.hasCapability(LibUsb.CAP_SUPPORTS_DETACH_KERNEL_DRIVER); // if cant, it's windows ot old lib if (LibUsb.setAutoDetachKernelDriver(handlerNS, true) == LibUsb.SUCCESS)
if (canDetach){ logPrinter.print("Handle kernel driver attach & detach", EMsgType.PASS);
int usedByKernel = LibUsb.kernelDriverActive(handlerNS, DEFAULT_INTERFACE);
if (usedByKernel == LibUsb.SUCCESS)
logPrinter.print("Can proceed with libusb driver", EMsgType.PASS); // we're good
else if (usedByKernel == 1) { // used by kernel
result = LibUsb.detachKernelDriver(handlerNS, DEFAULT_INTERFACE);
logPrinter.print("Detach kernel required", EMsgType.INFO);
if (result != 0) {
logPrinter.print("Detach kernel\n Returned: " + UsbErrorCodes.getErrCode(result), EMsgType.FAIL);
close();
return;
}
else
logPrinter.print("Detach kernel", EMsgType.PASS);
}
else
logPrinter.print("Can't proceed with libusb driver\n Returned: "+UsbErrorCodes.getErrCode(usedByKernel), EMsgType.FAIL);
}
else else
logPrinter.print("libusb doesn't support function 'CAP_SUPPORTS_DETACH_KERNEL_DRIVER'. It's normal. Proceeding.", EMsgType.WARNING); logPrinter.print("Skip kernel driver attach & detach", EMsgType.INFO);
/* /*
// Reset device // Reset device
result = LibUsb.resetDevice(handlerNS); result = LibUsb.resetDevice(handlerNS);