how to add a new key in Android device - android

I have a device with Tao3530chip and there is a Android 2.3.3 system on it. I'm also having a button at gpio100 on that Tao chip. I'd like to use that button to perform some control in the high level application.
If I map this gpio 100 to a certain key value in the .kl file, lets say KEY_ESC which has the value 1, what I need more is to change the high level response to this key event.
However, obviously its not a good mapping.
On the other hand, I dont know how to map my gpio100 to an unused or user-defined key value in the .kl file. I understanding is that maybe i need to perform the following:
#define KEY_MYDEFINE 0x123
(0x123 is an unused value.)
And map my gpio100 to KEY_MYDEFINE. And then later code the high level response for KEY_MYDEFINE. Is the procedure correct?

Related

Use mobilenet V1 model on Android

I'm trying to use the model used on this tutorial in an Android app. I wanted to modify DetectorActivity.java and TensorFlowMultiBoxDetector.java found here but it seems like i miss some parameters as imageMean, imageStd, inputName, outputLocationsName and outputScoresName.
From what I understand, input name is the name of the input for the model and both outputs are the names for the position and score output, but what do imageMean and imageStd stand for ?
I don't need to use the model with a camera, I just need to detect objects on bitmaps.
Your understanding of input/output names seems correct. They are tensorflow node names that can receive input and will contain the outputs at the end. imageMean and imageStd are used to scale the RGB values of the image to the mean of 0 and the standard deviation of 1. See the 8 lines starting from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/android/src/org/tensorflow/demo/TensorFlowMultiBoxDetector.java#L208
The TensorFlow android demo app you are referring to has been updated. It now supports MobileNets. Check it out at github: commit 53aabd5cb0ffcc1fd33cbd00eb468dd8d8353df2.

Dynamic properties specified by user

i was wondering if there is a chance to create comparable properties for objects defined by the user itself.
Following case: In my android app, the user creates a object "car", this object has predefined properties like color, size, doors, engine and so on ... but now, the user wants to add an individual property like "length" ... for that the user gets a plus button under the view to add this property ... now he can type in the wanted property, but what he dont want is to define the type of the input!
The users thinks "hey, its pretty obvious that length is expressed with a number so why i have to choose the type for this?"
I dont want to limit the user if i give them only predefined propertys.
I thought about saving every new parameter as a string, but then the values arent comparable anymore ... "900" is bigger than "1000" in a string comparison and so on. And i want to filter data and do queries later.
I dont disagree at all with the idea to let the user choose which type the field is, but i dont want to ask them too much in an android application.
If this all is not possible, how can i smartly get the information for the type from the user?
How can i handle this problem? Can someone give me a hint or keyword to search for?
Natural sorting might be the thing you are looking for. It will solve the problem with numbers.

Android: Google Place API delivers ZERO RESULTS

I'm going nuts on this one. I used Places Autocomplete before and that worked like a charm. e.g: https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&location=53.6020,53.6020&input=mcdonalds&key=
Now I'm trying to use the search in a range of 1000m of the users location, but I keep getting ZERO RESULTS. Can someone see, what I can't?
https://maps.googleapis.com/maps/api/place/search/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Thanx in advice!
You have to specify a type of search in your URL (i.e. /nearbysearch/, /textsearch/, etc)
try this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Also, don't forget to append your API key to the URL :)
Lastly, for debugging purposes, try to use a different latitude,longitude coordinate and see if that works (i.e. use the lat/lng for New York City).

Unable to pass certain IR remote key codes to Android

I'm trying to use an IR remote to pass certain key codes to Android. So far, I'm able to pass numeric keys (0-9) and D-pad keys (up, down, left, right, enter). Now I'm trying to extend the keys to include other characters like a-z.
The code that I'm modifying is an IR driver in the Linux kernel part of Android. It's similar to this driver. However, when I pass a value like KEY_A (maps "a" to 30: defined in Linux's include/linux/input.h), Android doesn't see it.
The section of code that passes the command up is the following:
input_report_key(cir->input, cir->last_key, 1);
input_report_key(cir->input, cir->last_key, 0);
input_sync(cir->input);
When I print cir->last_key, I can see the value 30 when I press the "a" button. However, I'm not sure how to trace the code from here to Android to see where the button press is being dropped.
In Android, I have a file called /system/usr/keylayout/qwerty.kl that maps values, e.g. 30 maps to "a". The problem is Android never gets the value of 30 when I press "a".
The keybit field of this structure has to be set to include all the key codes being passed.
For example,
set_bit(KEY_A, input_dev->keybit);

Why is the `sll` query parameter for a Maps URL being (sort of) ignored?

According to various references, Google Maps has a query param called sll which does the following:
Latitude,longitude of the point from which the business search
should be performed. You could use this to perform an off-centre
busness search. Google use it so "link to this page" can record a map
that has had the centre moved after performing a business search. When
requesting a route
map.getBounds().getSouthWest().toUrlValue() returns the
same value maps.google.com uses.
So, for instance, if (43.464258, -80.52041) happens to be in Waterloo, Ontario, and (42.24370, -82.98320) happens to be in Windsor, Ontario (many hundreds of kilometers away), then my interpretation of the above documentation would be that the following query:
https://maps.google.ca/maps?saddr=43.464258,-80.52041&daddr=mcdonalds&sll=42.24370,-82.98320
will do a search for "Mcdonalds" from Waterloo, to some McDonald's in Windsor.
Unfortunately, that's not what happens (click for yourself to see!). It ends up doing a search from the saddr point, to the nearest McDonald's to that point. The value of sll doesn't factor into it at all.
But here's where it gets weird! If I omit the sll parameter entirely, then Maps does something completely unexpected: it picks some random McDonald's in Toronto (a city that is many kilometers away from either Waterloo or Windsor). I need to add some sll parameter (for any value) to make Maps return a result in Waterloo (even though what I'm asking for is a result in Windsor).
Am I misinterpreting all the various sources of documentation about this parameter? Is this a bug on Maps' end? And, most importantly, is there any working way to do what I'm trying to do, even if it doesn't involve the sll parameter at all?
I can get it to work with a simple query :
from:43.464258,-80.52041 to:mcdonalds near 42.24370,-82.98320
Which gives the expected result. It won't work without near which is a keyword.
You can also search from:43.464258,-80.52041 to:mcdonalds, Windsor if you have the city name.
About the sll (and sspn) parameters, it doesn't work for directions AFAIK. It only works with searches for a single location.

Categories

Resources