hrk / no-frills-cpu-classic

No-frills CPU Control CLASSIC app for Android
https://play.google.com/store/apps/details?id=it.sineo.android.noFrillsCPUClassic
22 stars 14 forks source link

mmcblk0 ioscheduler not present on Minix X5 #2

Closed DaPa closed 11 years ago

DaPa commented 11 years ago

Instead it has mtdblock0. I made a quick patch in SysUtils.java and now I can change noop, deadline or cfg:


@@ -46,5 +46,6 @@
    private final static String scaling_stats_time_in_state = cpufreq_sys_dir + "stats/time_in_state";

-   private final static String ioscheduler = "/sys/block/mmcblk0/queue/scheduler";
+   private final static String ioscheduler1 = "/sys/block/mmcblk0/queue/scheduler";
+   private final static String ioscheduler2 = "/sys/block/mtdblock0/queue/scheduler";
    private final static String RE_FAKE_BLKDEV = "(loop|zram|dm-)[0-9]+";

@@ -235,4 +236,8 @@
    public static String[] getAvailableIOSchedulers() {
        String[] schedulers = null;
+       String ioscheduler = ioscheduler1;
+       if (!new File(ioscheduler1).exists()) {
+           ioscheduler = ioscheduler2;
+       }
        String[] aux = readStringArray(ioscheduler);
        if (aux != null) {
@@ -294,4 +299,8 @@
    public static String getIOScheduler() {
        String scheduler = null;
+       String ioscheduler = ioscheduler1;
+       if (!new File(ioscheduler1).exists()) {
+           ioscheduler = ioscheduler2;
+       }
        String[] schedulers = readStringArray(ioscheduler);
        if (schedulers != null) {

Btw, thank you for this open source code!

hrk commented 11 years ago

Thank you for this patch as well! :)