Hi,all In the input subsystem, I add another reader thread .Implementation method is the same as InputReaderThread. After that, android upper always restart. Does anyone known why?
The log is 8372.log.txt
Hi Yanhong,
1. Are you adding a support for new input device ? if yes, then do - "$getevent -p" on console and see if your device is getting listed there.
2. What are you trying to achieve in new reader thread - could you clarify more on that ?
3. Few observations from log...
01-01 00:46:00.179: DEBUG/Button Savior(5044): admin api detecting01-01 00:46:00.351: DEBUG/Button savir(5044): su not found
Are you trying to run something with su permission ??
in case if you are doing any thing with brightness ? then give proper permission to below node in init.rc file
write_int failed to open /dev/brightness
BR,
satish
Kindly click the verify answer button on this post if it answer your question.
Hi satish,
I want to add the function of the serial keys. Therefore, I add a reader thread, read the serial port to get the scan code, and then distribute.Now I just define a thread class, and then create a variable, it appears the restart phenomenon.I add the following contents:(1)================Define the thread class InputReaderThread2===============file:InputReader.h291 /* Reads raw events from the event hub and processes them, endlessly. */ 292 class InputReaderThread : public Thread { 293 public: 294 InputReaderThread(const sp<InputReaderInterface>& reader); 295 virtual ~InputReaderThread(); 296 297 private: 298 sp<InputReaderInterface> mReader; 299 300 virtual bool threadLoop(); 301 }; 302 /**************************add start*********************/ 303 /* Reads raw events from uart devices and processes them, endlessly. */ 304 class InputReaderThread2 : public Thread { 305 public: 306 InputReaderThread2(); 307 virtual ~InputReaderThread2(); 308 309 private: 310 virtual bool threadLoop(); 311 }; 312 /**************************add end*********************/ (2)================The realization of the functional=============== file:InputReader.cpp 627 // --- InputReaderThread --- 628 629 InputReaderThread::InputReaderThread(const sp<InputReaderInterface>& reader) : 630 Thread(/*canCallJava*/ true), mReader(reader) { 631 } 632 633 InputReaderThread::~InputReaderThread() { 634 } 635 636 bool InputReaderThread::threadLoop() { 637 mReader->loopOnce(); 638 return true; 639 } 640 /**************************add start*********************/ 641 // --- InputReaderThread2 --- 642 643 InputReaderThread2::InputReaderThread2() : 644 Thread(/*canCallJava*/ true) { 645 } 646 647 InputReaderThread2::~InputReaderThread2() { 648 } 649 650 bool InputReaderThread2::threadLoop() { 651 return true; 652 } 653/**************************add end*********************/ (3))=================Define the class variable============== file:InputManager.h class:InputManager 105 private: 106 sp<InputReaderInterface> mReader; 107 sp<InputReaderThread> mReaderThread; 108 /**************************add start*********************/ 109 sp<InputReaderThread2> mReaderThread2; 110 /**************************add end*********************/ 111 sp<InputDispatcherInterface> mDispatcher; 112 sp<InputDispatcherThread> mDispatcherThread; It appears the restart phenomenon after adding these. Now,it works well when I add "setprop libc.debug.malloc 10" to init.rc.But I do not know why.
Hi,
I am not sure but you need to relook your code for some kind of memory leak. As property you have mentioned is to be set when we debug memory
http://source.android.com/tech/debugging/native-memory.html
Also, you can refer to
http://code.google.com/p/android-serialport-api/
for serial port access
yanhong wu I want to add the function of the serial keys. Therefore, I add a reader thread, read the serial port to get the scan code, and then distribute.Now I just define a thread class, and then create a variable, it appears the restart phenomenon.
I want to add the function of the serial keys. Therefore, I add a reader thread, read the serial port to get the scan code, and then distribute.Now I just define a thread class, and then create a variable, it appears the restart phenomenon.
An alternate approach you can explore is to implement a kernel driver for the serial keys. This way android will see this a normal input device and you need not modify the android frameworks.
--------------------------------------------------------------------------------------------------------- Please click the Verify Answer button on this post if it answers your question.---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
Please click the Verify Answer button on this post if it answers your question.---------------------------------------------------------------------------------------------------------
Hi Vishveshwar,
I think that what you said is a good method, but I do not know how to operate the serial device in the kernel.Can you give me some guidance or some examples?In addition, after a few restarts, it is no longer reboot and run well.I suspect that android reboot is due to insufficient memory.Can you give me some suggestions on how to debug?
The latest test found that adding an integer variable in InputManger class also causes the android upper restarteg:TI_Android_GingerBread_2_3_4Sources/frameworks/base/include/ui/InputManager.h 84 class InputManager : public InputManagerInterface { 85 protected: 86 virtual ~InputManager(); 87 88 public: 89 InputManager( 90 const sp<EventHubInterface>& eventHub, 91 const sp<InputReaderPolicyInterface>& readerPolicy, 92 const sp<InputDispatcherPolicyInterface>& dispatcherPolicy); 93 94 // (used for testing purposes) 95 InputManager( 96 const sp<InputReaderInterface>& reader, 97 const sp<InputDispatcherInterface>& dispatcher); 98 99 virtual status_t start();100 virtual status_t stop();101 102 virtual sp<InputReaderInterface> getReader();103 virtual sp<InputDispatcherInterface> getDispatcher();104 105 private:106 sp<InputReaderInterface> mReader;107 sp<InputReaderThread> mReaderThread;108 /***********add start********/109 int abc;110 /************add end*********/111 sp<InputDispatcherInterface> mDispatcher;112 sp<InputDispatcherThread> mDispatcherThread;113 114 void initialize();115 };