Skip to content

Commit 8737e61

Browse files
authored
Update how-to-integrate-for-non-gki.md
1 parent 3521240 commit 8737e61

1 file changed

Lines changed: 0 additions & 71 deletions

File tree

docs/pages/how-to-integrate-for-non-gki.md

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -287,77 +287,6 @@ index 2ff887661237..e758d7db7663 100644
287287
return -EINVAL;
288288
```
289289

290-
### Safe Mode
291-
292-
To enable KernelSU Next's built-in Safe Mode, you should modify the `input_handle_event` function in `drivers/input/input.c`:
293-
294-
::: tip
295-
It's strongly recommended to enable this feature, it's very useful for preventing bootloops!
296-
:::
297-
298-
```diff
299-
diff --git a/drivers/input/input.c b/drivers/input/input.c
300-
index 45306f9ef247..815091ebfca4 100755
301-
--- a/drivers/input/input.c
302-
+++ b/drivers/input/input.c
303-
@@ -367,10 +367,13 @@ static int input_get_disposition(struct input_dev *dev,
304-
return disposition;
305-
}
306-
307-
+#ifdef CONFIG_KSU
308-
+extern bool ksu_input_hook __read_mostly;
309-
+extern int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code, int *value);
310-
+#endif
311-
+
312-
static void input_handle_event(struct input_dev *dev,
313-
unsigned int type, unsigned int code, int value)
314-
{
315-
int disposition = input_get_disposition(dev, type, code, &value);
316-
+ #ifdef CONFIG_KSU
317-
+ if (unlikely(ksu_input_hook))
318-
+ ksu_handle_input_handle_event(&type, &code, &value);
319-
+ #endif
320-
321-
if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN)
322-
add_input_randomness(type, code, value);
323-
```
324-
325-
::: info ENTERING SAFE MODE ACCIDENTALLY?
326-
If you're using manual integration and don't disable `CONFIG_KPROBES`, the user will be able to trigger Safe Mode by pressing the volume down button after booting! Therefore, if you're using manual integration, it's necessary to disable `CONFIG_KPROBES`!
327-
:::
328-
329-
### Failed to execute `pm` in terminal?
330-
331-
You should modify `fs/devpts/inode.c`. Reference:
332-
333-
```diff
334-
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
335-
index 32f6f1c68..d69d8eca2 100644
336-
--- a/fs/devpts/inode.c
337-
+++ b/fs/devpts/inode.c
338-
@@ -602,6 +602,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
339-
return dentry;
340-
}
341-
342-
+#ifdef CONFIG_KSU
343-
+extern int ksu_handle_devpts(struct inode*);
344-
+#endif
345-
+
346-
/**
347-
* devpts_get_priv -- get private data for a slave
348-
* @pts_inode: inode of the slave
349-
@@ -610,6 +612,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
350-
*/
351-
void *devpts_get_priv(struct dentry *dentry)
352-
{
353-
+ #ifdef CONFIG_KSU
354-
+ ksu_handle_devpts(dentry->d_inode);
355-
+ #endif
356-
if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
357-
return NULL;
358-
return dentry->d_fsdata;
359-
```
360-
361290
Finally, build your kernel again, and KernelSU Next should work correctly.
362291

363292

0 commit comments

Comments
 (0)