On 3月23日, 下午2時55分, Chinmay S <[email protected]> wrote:
> Regarding the multiple instances of .so files getting dynamically-linked to
> various processes,
> There might be some doc somewhere which says that. My conclusions were from
> studying the "framework" code
> and experimenting and observing the results on a device with my "custom" HAL
> in place.
> Here is a simple experiment you can try on your own:
> 1. Declare a Global variable in sensors.c
> 2. Update the global variable in *control_activate*.
> 3. Log the value of the global variable in *data_poll*.
> You can see that the update made in control_activate is NOT reflected in *
> data_poll*.

Thanks. I made some tests.
Yes, as you said.

> Regarding the necessity for any locking mechanism (mutex?)
> I do not foresee the need for any locks.
>
> Though multiple instances of *sensors.so* exist and each may try to read the
> same input file,
> Each *sensors.so* does so with it own handle to the file. This means the
> kernel already is
> managing multiple access using multiple handles & you need not worry about

Hmm, I saw in my devices, two instances
tried to read input events, and only one
can get the event. Sometime the other instance
complained no data to read, as shown below:

03-23 16:55:10.361 D/KbdSensor( 2369): data_poll: dev=0x82ba030 fd=62
03-23 16:55:10.381 D/KbdSensor( 2369): type=4 scancode=4 value=29 from
fd=62
03-23 16:55:10.381 D/KbdSensor( 1463): type=1 scancode=29 value=0 from
fd=78
03-23 16:55:10.381 D/KbdSensor( 1463): type=0 scancode=0 value=0 from
fd=78
03-23 16:55:10.391 D/KbdSensor( 1463): type=1 scancode=56 value=0 from
fd=78
03-23 16:55:10.391 D/KbdSensor( 2369): type=4 scancode=4 value=56 from
fd=62
03-23 16:55:10.391 D/KbdSensor( 1463): type=0 scancode=0 value=0 from
fd=78
03-23 16:55:10.391 E/KbdSensor( 2369): insufficient input data(0)?
fd=62

Is it a normal behavior (expected) and
can safely be ignored?
I don't think so since it looks like a race condition.

How about a typical sensor on a smart phone?
Does each instance of sensors.so get the same
events from the input device?

Regards,

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to