[android-developers] Re: Simulating Mouse Click
Hi there Have someone found solution for this yet? I built a device which can control cursor, but i still can not click On Wednesday, February 1, 2012 7:13:20 AM UTC+2, Dritan wrote: OK so first things first, yes I was kind of angry/upset because it seemed like I had tried all possible routes and have no solution. I apologize if my threat to re-post this question every week (lol) came off too strong. But honestly, I've been at this for nearly a month where I bought a Bluetooth adapter for $80 and hooked it up to Arduino as my driver- interface. I used Arduino to communicate with the adapter, but because the adapter does not have a HID profile, I am kind of stuck. (Re-)write a HID profile? how to add profile to BT stack? Re-invent the wheel? Are my #googling skills up to par? So I resorted to reading a bluetooth stream from the device via BT. I manually send signals to Arduino (from button or typing) which get sent over BT to the tablet. I've got IME's down. But for mouse clicks and motions and pressure and all the goodies ... I've been royally stuck :( I'm sorry but in the name of learning I shall continue to ask! ..and thank you for replying :) Dritan On Jan 31, 1:20 pm, Kristopher Micinski krismicin...@gmail.com wrote: On Tue, Jan 31, 2012 at 4:01 PM, Dritan djdea...@gmail.com wrote: Thank you for your reply Kris. I am trying to create a low-level mapping where some button press on my 22-button device is to be seen as leftclick, by following this configuration: http://source.android.com/tech/input/key-layout-files.html I know Android is a flexible system and without rooting a device, it is TOTALLY possible to create your own input device as amouse+ keyboard + touchpad + braille + whatever kind of input you wish to send to android. (NOT simulate keys, but actually send the corresponding byes for LeftClick or RightClick or move pointer). I totally agree with you. It's not that what you're doing is fundamentally flawed, it's that you're thinking about it the wrong way. You're looking to solve it using the naive hackey behavior typical of malware. You have to remember that your app would be potentially killed off at any time, so even if you launched it as a background and were able to register clicks to the toplevel view, your app could always annoyingly disappear! Consider a professional artists who purchases a digital drawing pad *with* a stylus pen for accuracy and all his/her drawings on the drawing pad are directly sent to Android as legitmouseor stylus events. This includes the pressure of the lines drawn as well, without having to directly simulate each event. True. It just seems that not one Google employee seems to know about this. Documentation is barely existent (and whatever is there is very poor), books don't help (not one book dares touch on this topic). I've gone back and forth all over the web to find an answer and unfortunately, only someone in this area of expertise can actually help me. Well, to be fair, this list isn't something that Google is responsible for answering questions on. What better place to post a question about Android than the source itself? Personally I did not know that you could add such low level support at the application level. The only thing I'm aware of is adding HID profiles, and the docs for those are here: http://source.android.com/tech/input/overview.html Thank you, Dritan p.s. If I don't get a reply from a competent Google employee (or really, anyone who's competent in this area), I shall re-post this question with a different title, every single week. I don't want to root the phone, nor do I feel like re-compiling the source to get the .java files for the source (even then it's a tremendous headache). Any help related directly to this matter is greatly appreciated, thank you! That's a very passive aggressive threat.. I'm sure the discussion around the office will be something like did you answer that guy yet, tom? No, he said he would repost every week until I did, I figured I'd see how long he could keep it up. What do you mean by recompiling the source to get the java files for the source? That doesn't make any sense, you already have all the system source, it's in the public repository, and you can browse and modify it yourself. The reason you don't want to do so is that if you do, nobody will have your hacked firmware, unless Google accepted your patch, which they might do. Your problem is that what you're wanting to write isn't an app, it's a driver for the device. You won't be able to do that through an app, the system doesn't work like that. There isn't much HID support, from cupcake onward, iirc, because it's just not very
[android-developers] Re: Simulating Mouse Click
Thank you for your reply Kris. I am trying to create a low-level mapping where some button press on my 22-button device is to be seen as left click, by following this configuration: http://source.android.com/tech/input/key-layout-files.html I know Android is a flexible system and without rooting a device, it is TOTALLY possible to create your own input device as a mouse + keyboard + touchpad + braille + whatever kind of input you wish to send to android. (NOT simulate keys, but actually send the corresponding byes for Left Click or Right Click or move pointer). Consider a professional artists who purchases a digital drawing pad *with* a stylus pen for accuracy and all his/her drawings on the drawing pad are directly sent to Android as legit mouse or stylus events. This includes the pressure of the lines drawn as well, without having to directly simulate each event. It just seems that not one Google employee seems to know about this. Documentation is barely existent (and whatever is there is very poor), books don't help (not one book dares touch on this topic). I've gone back and forth all over the web to find an answer and unfortunately, only someone in this area of expertise can actually help me. What better place to post a question about Android than the source itself? Thank you, Dritan p.s. If I don't get a reply from a competent Google employee (or really, anyone who's competent in this area), I shall re-post this question with a different title, every single week. I don't want to root the phone, nor do I feel like re-compiling the source to get the .java files for the source (even then it's a tremendous headache). Any help related directly to this matter is greatly appreciated, thank you! On Jan 30, 6:49 pm, Kristopher Micinski krismicin...@gmail.com wrote: Anyone have any experience with custom Bluetooth devices and simulating key mouse events? If View.performClick() is the only way, is there a way to obtain the view of the top Activity and inject a click event? (again, not clicking at an OK or Cancel, but merely register a click that the activity can pickup and pass it down as an event) This is also impossible: consider the background service that grabs the current view and records the contents of it to a log, which is then later sent out to my service. (I'm trying to point you at counterexamples so you'll have some rationale beyond just a you can't do that.) kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Simulating Mouse Click
On Tue, Jan 31, 2012 at 4:01 PM, Dritan djdea...@gmail.com wrote: Thank you for your reply Kris. I am trying to create a low-level mapping where some button press on my 22-button device is to be seen as left click, by following this configuration: http://source.android.com/tech/input/key-layout-files.html I know Android is a flexible system and without rooting a device, it is TOTALLY possible to create your own input device as a mouse + keyboard + touchpad + braille + whatever kind of input you wish to send to android. (NOT simulate keys, but actually send the corresponding byes for Left Click or Right Click or move pointer). I totally agree with you. It's not that what you're doing is fundamentally flawed, it's that you're thinking about it the wrong way. You're looking to solve it using the naive hackey behavior typical of malware. You have to remember that your app would be potentially killed off at any time, so even if you launched it as a background and were able to register clicks to the toplevel view, your app could always annoyingly disappear! Consider a professional artists who purchases a digital drawing pad *with* a stylus pen for accuracy and all his/her drawings on the drawing pad are directly sent to Android as legit mouse or stylus events. This includes the pressure of the lines drawn as well, without having to directly simulate each event. True. It just seems that not one Google employee seems to know about this. Documentation is barely existent (and whatever is there is very poor), books don't help (not one book dares touch on this topic). I've gone back and forth all over the web to find an answer and unfortunately, only someone in this area of expertise can actually help me. Well, to be fair, this list isn't something that Google is responsible for answering questions on. What better place to post a question about Android than the source itself? Personally I did not know that you could add such low level support at the application level. The only thing I'm aware of is adding HID profiles, and the docs for those are here: http://source.android.com/tech/input/overview.html Thank you, Dritan p.s. If I don't get a reply from a competent Google employee (or really, anyone who's competent in this area), I shall re-post this question with a different title, every single week. I don't want to root the phone, nor do I feel like re-compiling the source to get the .java files for the source (even then it's a tremendous headache). Any help related directly to this matter is greatly appreciated, thank you! That's a very passive aggressive threat.. I'm sure the discussion around the office will be something like did you answer that guy yet, tom? No, he said he would repost every week until I did, I figured I'd see how long he could keep it up. What do you mean by recompiling the source to get the java files for the source? That doesn't make any sense, you already have all the system source, it's in the public repository, and you can browse and modify it yourself. The reason you don't want to do so is that if you do, nobody will have your hacked firmware, unless Google accepted your patch, which they might do. Your problem is that what you're wanting to write isn't an app, it's a driver for the device. You won't be able to do that through an app, the system doesn't work like that. There isn't much HID support, from cupcake onward, iirc, because it's just not very mature. There are some projects out there aiming to support this eventually, but I don't know a general way to get support for your device on Android if it has to do lower level things.. http://code.google.com/p/androhid/ For example kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Simulating Mouse Click
On Tue, Jan 31, 2012 at 4:01 PM, Dritan djdea...@gmail.com wrote: I am trying to create a low-level mapping where some button press on my 22-button device is to be seen as left click, by following this configuration: http://source.android.com/tech/input/key-layout-files.html I know Android is a flexible system and without rooting a device, it is TOTALLY possible to create your own input device as a mouse + keyboard + touchpad + braille + whatever kind of input you wish to send to android. (NOT simulate keys, but actually send the corresponding byes for Left Click or Right Click or move pointer). Not at the SDK level. You mentioned that your device uses the Bluetooth HID profile. Find some existing Bluetooth mouse/keyboard/whatever that has the behaviors you want, and reverse-engineer how they're doing it through the Bluetooth HID profile. Or, follow the Bluetooth HID standards, which I am sure are written up somewhere. Or, visit http://source.android.com, click on the Community tab, find the right Google Group that might deal with hardware driver issues, and inquire there about their level of Bluetooth HID support. This Google Group is for development with the Android SDK. It is absolutely is not possible for an ordinary SDK application to inject input events to arbitrary applications on unrooted devices. That would represent a world-class security flaw. Consider a professional artists who purchases a digital drawing pad *with* a stylus pen for accuracy and all his/her drawings on the drawing pad are directly sent to Android as legit mouse or stylus events. This includes the pressure of the lines drawn as well, without having to directly simulate each event. AFAIK, all of which would have be handled through the existing Bluetooth HID support, or possibly via patches to improve the Bluetooth HID support. It just seems that not one Google employee seems to know about this. Oh, I am certain a few do. You will have better luck once you ask on a relevant list, one that would pertain to the functionality of the Bluetooth HID drivers. books don't help (not one book dares touch on this topic). There is an Android internals book that I know of that is under development, but I don't know how much the author will go into Bluetooth profiles, let alone how much that will be useful to you. Heck, I don't even know when he'll get it done, though I've pestered him about it. p.s. If I don't get a reply from a competent Google employee (or really, anyone who's competent in this area), I shall re-post this question with a different title, every single week. OMG! How will we cope? If only somebody had invented the email filter, so that we can block people who attack us with unwanted messages! Without this, we're doomed! Doomed, I say! -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.7 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Simulating Mouse Click
OK so first things first, yes I was kind of angry/upset because it seemed like I had tried all possible routes and have no solution. I apologize if my threat to re-post this question every week (lol) came off too strong. But honestly, I've been at this for nearly a month where I bought a Bluetooth adapter for $80 and hooked it up to Arduino as my driver- interface. I used Arduino to communicate with the adapter, but because the adapter does not have a HID profile, I am kind of stuck. (Re-)write a HID profile? how to add profile to BT stack? Re-invent the wheel? Are my #googling skills up to par? So I resorted to reading a bluetooth stream from the device via BT. I manually send signals to Arduino (from button or typing) which get sent over BT to the tablet. I've got IME's down. But for mouse clicks and motions and pressure and all the goodies ... I've been royally stuck :( I'm sorry but in the name of learning I shall continue to ask! ..and thank you for replying :) Dritan On Jan 31, 1:20 pm, Kristopher Micinski krismicin...@gmail.com wrote: On Tue, Jan 31, 2012 at 4:01 PM, Dritan djdea...@gmail.com wrote: Thank you for your reply Kris. I am trying to create a low-level mapping where some button press on my 22-button device is to be seen as leftclick, by following this configuration:http://source.android.com/tech/input/key-layout-files.html I know Android is a flexible system and without rooting a device, it is TOTALLY possible to create your own input device as amouse+ keyboard + touchpad + braille + whatever kind of input you wish to send to android. (NOT simulate keys, but actually send the corresponding byes for LeftClick or RightClick or move pointer). I totally agree with you. It's not that what you're doing is fundamentally flawed, it's that you're thinking about it the wrong way. You're looking to solve it using the naive hackey behavior typical of malware. You have to remember that your app would be potentially killed off at any time, so even if you launched it as a background and were able to register clicks to the toplevel view, your app could always annoyingly disappear! Consider a professional artists who purchases a digital drawing pad *with* a stylus pen for accuracy and all his/her drawings on the drawing pad are directly sent to Android as legitmouseor stylus events. This includes the pressure of the lines drawn as well, without having to directly simulate each event. True. It just seems that not one Google employee seems to know about this. Documentation is barely existent (and whatever is there is very poor), books don't help (not one book dares touch on this topic). I've gone back and forth all over the web to find an answer and unfortunately, only someone in this area of expertise can actually help me. Well, to be fair, this list isn't something that Google is responsible for answering questions on. What better place to post a question about Android than the source itself? Personally I did not know that you could add such low level support at the application level. The only thing I'm aware of is adding HID profiles, and the docs for those are here: http://source.android.com/tech/input/overview.html Thank you, Dritan p.s. If I don't get a reply from a competent Google employee (or really, anyone who's competent in this area), I shall re-post this question with a different title, every single week. I don't want to root the phone, nor do I feel like re-compiling the source to get the .java files for the source (even then it's a tremendous headache). Any help related directly to this matter is greatly appreciated, thank you! That's a very passive aggressive threat.. I'm sure the discussion around the office will be something like did you answer that guy yet, tom? No, he said he would repost every week until I did, I figured I'd see how long he could keep it up. What do you mean by recompiling the source to get the java files for the source? That doesn't make any sense, you already have all the system source, it's in the public repository, and you can browse and modify it yourself. The reason you don't want to do so is that if you do, nobody will have your hacked firmware, unless Google accepted your patch, which they might do. Your problem is that what you're wanting to write isn't an app, it's a driver for the device. You won't be able to do that through an app, the system doesn't work like that. There isn't much HID support, from cupcake onward, iirc, because it's just not very mature. There are some projects out there aiming to support this eventually, but I don't know a general way to get support for your device on Android if it has to do lower level things.. http://code.google.com/p/androhid/ For example kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to
[android-developers] Re: Simulating Mouse Click
Thanks Kris but that won't help me much. I know it's pretty scary to be able to issue a motion event anywhere on the screen promptly allowing an attacker to overtake the tablet. But my intentions are control through hardware - nothing programmatic. All input will come from the user. Until I figure out how to do it via HID profiles which Android supports (but have little experience in), I am stuck on a threaded means to get signals (input) from the device. I do not want to simulate a mouse click at specific coordinates, I want to simulate them as the user moves his/her thumb on the joystick on my custom Bluetooth controller. Anyone have any experience with custom Bluetooth devices and simulating key mouse events? If View.performClick() is the only way, is there a way to obtain the view of the top Activity and inject a click event? (again, not clicking at an OK or Cancel, but merely register a click that the activity can pickup and pass it down as an event) Thanks, Dritan On Jan 30, 3:07 pm, Kristopher Micinski krismicin...@gmail.com wrote: In your activity? Or throughout the system. If you can write an app that makes random keyclicks that seems pretty scary, right? So I'm guessing that this isn't going to be possible. That comment probably seemed unhelpful, huh? View.performClick is probably what you want.. kris On Mon, Jan 30, 2012 at 2:35 PM, Dritan djdea...@gmail.com wrote: Hello, I am trying to make a custom Bluetooth device to comply with a HID profile so that my tablet can recognize it as a keyboard mouse combo. I've come up with a neat way to organize the keys and custom joysticks, and I thus need custom support for this device. (Each hand gets a joystick 18 keys) At this moment I can poll the device, block until a key is pressed through a custom IME. I have been researching on how to simulate a simple mouse click and eventually the goal is to use the custom joysticks to move the pointer across the screen. I have my custom IME running in the background and it can send KeyEvent's no problem, however, a mouse click seems to be virtually impossible. How can add full support to my custom hardware so that mouse and keyboard work together? Thank you, Dritan -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Simulating Mouse Click
Anyone have any experience with custom Bluetooth devices and simulating key mouse events? If View.performClick() is the only way, is there a way to obtain the view of the top Activity and inject a click event? (again, not clicking at an OK or Cancel, but merely register a click that the activity can pickup and pass it down as an event) This is also impossible: consider the background service that grabs the current view and records the contents of it to a log, which is then later sent out to my service. (I'm trying to point you at counterexamples so you'll have some rationale beyond just a you can't do that.) kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en