LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Firefox OS, Sailfish OS, Maemo, MeeGo, Ubuntu Mobile, WebOS, Open Mobile Alliance and other similar projects and products.
A reminder that LQ now has a dedicated Android sister site: AndroidQuestions.org

Notices


Reply
  Search this Thread
Old 03-29-2017, 05:01 PM   #1
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Rep: Reputation: Disabled
Question Help with Linux Question on Android.


Is it possible to hide a file called event inside /dev/input/ from a specific app in android? Or some way to make a specific android app unable to search or read that file? I am trying to hide /dev/input/event3 from an app but chmod 000 or renaming the event doesn't work to hide it or remove it. The only thing that works is deleting the file but that way it doesn't work for all apps and needs a reboot to restore the file, restoring the file without rebooting doesn't work. Any ideas?
The event 3 is tied to this built-in device:
http://imgur.com/WeyPcKz
 
Old 03-29-2017, 08:17 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,168

Rep: Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562
I'll say hello and welcome but also you may be able to get better advice at http://www.androidquestions.org/forum.php
 
Old 03-30-2017, 12:57 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,965
Blog Entries: 4

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
sounds a lot like an x-y-problem to me:
Quote:
User wants to do X.
User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
User doesn't know how to do Y either.
User asks for help with Y.
Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.
however, you night get better help with android questions on one of the many android-centric forums.
not that we're unwilling to help.
 
Old 03-30-2017, 05:05 PM   #4
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Not really like I said deleting the file called event3 disables the device called "joystick" now I am just trying to find a way to disable it for only specific android apps. Thanks I tried asking in android questions too but so far no luck.
 
Old 03-31-2017, 02:06 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,965
Blog Entries: 4

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
actually i forgot to explicitely ask the pertinent question:

What are you really trying to achieve?
disable the joystick for a specific app? why? which app? what isn't working? since when do smartphones have joysticks?
so much info is missing here...
 
Old 03-31-2017, 03:37 AM   #6
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Ok, here we go, My android tablet has a built-in gamepad, this gamepad is composed of the devices called "joy_key" (the dpad and all buttons) and "joystick" (the analog joysticks), see screenshot:
http://imgur.com/WeyPcKz

The problem is that a bunch of android games (like implosion) only accept the input of the "joystick" but not the "joy_key" making them unplayable because they also disable touchscreen controls if they detect a gamepad. I discovered that if I delete the file called event3 inside /dev/input with root explorer I can disable the device called "joystick", same with the file called event2, deleting it disables "joy_key", but doing this disables the devices globally for all apps and a reboot is necessary to restore those files, also these games require both the buttons and analog sticks to progress so disabling just one device doesn't help much. Disabling both devices makes the touchscreen controllers appear in those games, so I am looking for a way to hide those files just for those games specifically without having to delete them and disabling the devices globally, that way I could use a mapping tool to map the touchscreen controls to the built-in gamepad.
 
Old 03-31-2017, 10:34 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,965
Blog Entries: 4

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
ok, the crucial bit of information is that you have no influence over how those games work, or at least i'll assume so (but it's an avenue that you should continue investigating).

what is the screenshot a screenshot of?

thinking linux, i get the feeling that these files are not actual files but somehow represent input devices, but if you can delete them, maybe you can also move/rename them?

here's what i'd try:
Code:
# cd /path/to/where/the/files/are
# mv event3 not.event3
and maybe also
Code:
ln -s event2 event3
(that should create a symlink called event3, but actually pointing to event2. but really the first step should be enough.)

that's still globally, and i can't think of any other way, but that way you can undo the change after you finished playing:
Code:
# mv -f not.event3 event3
ps:
the '#' denotes being root.
 
Old 03-31-2017, 01:38 PM   #8
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hey thanks for the help man, the screenshot as you guessed is a screenshot of the android input devices:
http://imgur.com/Z4rBzM8

But like I said in the op renaming or moving the file doesn't work to disable the "joystick" the only thing that works is deleting the file for some reason, even if I use chmod 000 or change the file group and owner it doesn't work to disable it, apps still can detect it for some reason. Also a weird thing is that if I change the permissions and then delete the file the "joystick" still works and apps can detect it, the only thing that works is deleting the file without chmod. Anyway I tried your solution:
http://imgur.com/x7Ffr29
http://imgur.com/gDwoNJS

Sadly the "joystick" doesn't get disabled.
 
Old 04-02-2017, 01:26 AM   #9
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
I made some progress, apparently the event3 is a special/device file:
https://en.m.wikipedia.org/wiki/Device_file

So to restore it I have to first use ls -l /dev/input to know the minor and major numbers of the special file: http://stackoverflow.com/questions/1...mbers-in-linux

Then I need to use the mknod command to create the special file.
http://wiki.linuxquestions.org/wiki/Mknod

The problem is that I created the file event3 perfectly again after deleting it but the "joystick" functionality doesn't get restored without a reboot, any ideas?

Last edited by Talos91; 04-02-2017 at 01:32 AM.
 
Old 04-02-2017, 04:03 AM   #10
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
It appears it is possible to restore /dev without a reboot:
https://superuser.com/questions/3882...after-rming-it

But android has no /etc/udev directory, any help?
 
Old 04-03-2017, 03:48 AM   #11
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
After deleting event3 and then creating it again using mknod I used the command getevent for event3 and if I move the "joystick" the terminal does detect the joysticks movement, the problem is that all android apps don't detect it even after creating it again with mknod, why would that be? Why would deleting the event 3 file make all apps stop detecting the "joystick" but creating the file again perfectly with mknod doesn't make all apps start detecting "joystick" again? Ideas?
 
Old 04-03-2017, 12:59 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,965
Blog Entries: 4

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
why why why... why is android such an opaque operating system even though it's open source ... why is it such a b*tch to script & customize... many questions even the guys at xda-developers do not have answers for.
but once you learn to code in & for android, you can make $$$! maybe that's why it's kept a secret.
i prefer the FLOSS way though.
 
Old 04-14-2017, 10:36 PM   #13
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Finally solved it!!
After deleting the special file I use: mknod -m 066 /dev/input/event3 c 13 67 to restore it and then I use root explorer to change event3 to the correct permissions and the correct user and group, this restores the gamepad functionality without a reboot. The permissions in the mknod command have to be 066 if you use the correct ones 660 this doesn't work for some reason, android is very weird.
 
Old 04-15-2017, 12:48 AM   #14
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Apparently just using the above command restores the devices even if you don't change the permissions or group, weird. BTW this process can be automated with an app like tasker or xposed edge to delete the files and restore them easily, to delete them just use su then rm /dev/input/event*
 
Old 04-15-2017, 03:20 AM   #15
Talos91
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Relevant:
https://forum.xda-developers.com/gen...pad-2-t3134339
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to set up Android Studio for creating Android Apps And Games Using Linux LXer Syndicated Linux News 0 06-23-2016 08:01 PM
Ubuntu on Android help/question barnac1e Linux - Mobile 1 04-08-2012 09:42 AM
May I ask a question about Android here? koshihaku Linux - Software 1 09-17-2011 09:48 PM
LXer: Get Started with Android application development using Linux and Android SDK LXer Syndicated Linux News 0 01-06-2011 02:50 PM
Android Development in Linux.How To install Android Emulator?? jeevanism Linux - Mobile 3 12-28-2010 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration