-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MenosGrante/lakka
Update 2.0
- Loading branch information
Showing
59 changed files
with
831 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.4.1) | ||
add_library( native-lib SHARED src/main/cpp/native-lib.cpp ) | ||
add_library( payload_launcher SHARED src/main/cpp/payload_launcher.cpp ) | ||
add_library( lakka_launcher SHARED src/main/cpp/lakka_launcher.cpp ) | ||
include_directories(src/main/cpp/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <cstring> | ||
#include <thread> | ||
#include <chrono> | ||
#include <jni.h> | ||
#include <linux/usb/ch9.h> | ||
#include <linux/usbdevice_fs.h> | ||
#include <sys/ioctl.h> | ||
extern "C" JNIEXPORT void JNICALL | ||
Java_com_pavelrekun_rekado_services_lakka_LakkaLoader_nativeControlReadUnbounded(JNIEnv *env, | ||
jclass, | ||
jint fd, | ||
jint size) { | ||
|
||
|
||
char* buffer = new char[sizeof(usb_ctrlrequest) + size]; | ||
usb_ctrlrequest* header = (usb_ctrlrequest*) buffer; | ||
header->bRequestType = USB_TYPE_STANDARD | USB_RECIP_ENDPOINT | USB_DIR_IN; | ||
header->bRequest = 0; | ||
header->wValue = 0; | ||
header->wIndex = 0; | ||
header->wLength = (__le16) size; | ||
memset(&buffer[sizeof(usb_ctrlrequest)], 0, (size_t) size); | ||
|
||
usbdevfs_urb* urb = (usbdevfs_urb*) new char[sizeof(usbdevfs_urb) + 1024]; | ||
memset(urb, 0, sizeof(usbdevfs_urb) + 1024); | ||
urb->type = USBDEVFS_URB_TYPE_CONTROL; | ||
urb->endpoint = 0; | ||
urb->buffer = buffer; | ||
urb->buffer_length = sizeof(usb_ctrlrequest) + size; | ||
urb->usercontext = (void*) 0xf0f; | ||
|
||
|
||
ioctl(fd, USBDEVFS_SUBMITURB, urb); | ||
std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
ioctl(fd, USBDEVFS_DISCARDURB, urb); | ||
usbdevfs_urb* purb; | ||
do { | ||
if (ioctl(fd, USBDEVFS_REAPURB, &purb)) { | ||
break; | ||
} | ||
} while (purb != urb); | ||
|
||
delete[] urb; | ||
delete[] buffer; | ||
} |
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/pavelrekun/rekado/screens/lakka_fragment/LakkaContract.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.pavelrekun.rekado.screens.lakka_fragment | ||
|
||
interface LakkaContract { | ||
|
||
interface View { | ||
|
||
fun initViews() | ||
|
||
fun initCBFSCategory() | ||
|
||
fun initCorebootCategory() | ||
|
||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/pavelrekun/rekado/screens/lakka_fragment/LakkaFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.pavelrekun.rekado.screens.lakka_fragment | ||
|
||
import android.os.Bundle | ||
import android.support.v4.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.pavelrekun.rekado.R | ||
import com.pavelrekun.rekado.base.BaseActivity | ||
|
||
class LakkaFragment : Fragment() { | ||
|
||
private lateinit var mvpView: LakkaContract.View | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
val view = inflater.inflate(R.layout.fragment_lakka, container, false) | ||
val activity = activity as BaseActivity | ||
|
||
mvpView = LakkaView(activity) | ||
return view | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
mvpView.initViews() | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/pavelrekun/rekado/screens/lakka_fragment/LakkaView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.pavelrekun.rekado.screens.lakka_fragment | ||
|
||
import android.support.v4.content.ContextCompat | ||
import com.pavelrekun.rekado.R | ||
import com.pavelrekun.rekado.base.BaseActivity | ||
import com.pavelrekun.rekado.services.lakka.LakkaHelper | ||
import kotlinx.android.synthetic.main.fragment_lakka.* | ||
|
||
class LakkaView(private val activity: BaseActivity) : LakkaContract.View { | ||
|
||
override fun initViews() { | ||
activity.setTitle(R.string.navigation_lakka) | ||
|
||
initCBFSCategory() | ||
initCorebootCategory() | ||
} | ||
|
||
override fun initCBFSCategory() { | ||
if (LakkaHelper.checkCBFSPresent()) { | ||
activity.lakkaCBFSStatus.text = activity.getString(R.string.lakka_tools_ready) | ||
activity.lakkaCBFSStatus.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lakka_ready, 0, 0, 0) | ||
activity.lakkaCBFSStatus.setTextColor(ContextCompat.getColor(activity, R.color.colorGreen)) | ||
} else { | ||
activity.lakkaCBFSStatus.text = activity.getString(R.string.lakka_tools_not_ready) | ||
activity.lakkaCBFSStatus.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lakka_not_ready, 0, 0, 0) | ||
activity.lakkaCBFSStatus.setTextColor(ContextCompat.getColor(activity, R.color.colorRed)) | ||
} | ||
|
||
activity.lakkaCBFSDate.text = activity.getString(R.string.lakka_last_update, LakkaHelper.PAYLOAD_UPDATE_DATE) | ||
} | ||
|
||
override fun initCorebootCategory() { | ||
if (LakkaHelper.checkCorebootPresent()) { | ||
activity.lakkaCorebootStatus.text = activity.getString(R.string.lakka_tools_ready) | ||
activity.lakkaCorebootStatus.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lakka_ready, 0, 0, 0) | ||
activity.lakkaCorebootStatus.setTextColor(ContextCompat.getColor(activity, R.color.colorGreen)) | ||
} else { | ||
activity.lakkaCorebootStatus.text = activity.getString(R.string.lakka_tools_not_ready) | ||
activity.lakkaCorebootStatus.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lakka_not_ready, 0, 0, 0) | ||
activity.lakkaCorebootStatus.setTextColor(ContextCompat.getColor(activity, R.color.colorRed)) | ||
} | ||
|
||
activity.lakkaCorebootDate.text = activity.getString(R.string.lakka_last_update, LakkaHelper.COREBOOT_UPDATE_DATE) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.