s5pc110/s5pv210 bma150 重力感应

本文介绍在三星S5PC110平台上移植BMA150加速度传感器的过程,包括驱动程序的位置、系统配置修改及权限设置等关键步骤,并解决了Launcher旋转问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在移植android2.3的系统,芯片是三星的s5pc110。移植bam150的时候遇到了些问题,记录下。不对程序做具体分析,三星在驱动方面做的比较成熟。也许这些记录对想了解驱动的,用处不大,不过是实践的经验,如果你在项目工作中遇到,也许是个不错的参考。
<wbr style="line-height:25px"><div style="line-height:25px">1,驱动程序的位置</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>drivers\i2c\chips\bma150_driver.c 和bma150_driver.h</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>然后在arch\arm\mach-s5pv210\mach-smdkc110.c中对IIC地址配置</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>{</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>I2C_BOARD_INFO("bma150", (0x38)), </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>},</div> <div style="line-height:25px">2,系统中的改动</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>(1)android2.3.4_GB_T34\out\target\product\smdkc110\root\init.rc</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>修改init.rc,(也许文件位置不同,不过做这个的都知道init.rc在那里,下面红色的比较重要)</div> <div style="line-height:25px"> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span>#change accelerometer device permission</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span><span style="color:#ff0000; line-height:25px">chmod 666 /dev/bma150</span> </div> <div style="line-height:25px"> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span># change ecompass device permission</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span>chmod 666 /dev/mmc31xx</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span>chmod 666 /dev/ecompass_ctrl</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> <span style="color:#ff0000; line-height:25px"></span></span><span style="color:#ff0000; line-height:25px">mkdir /data/misc/sensors 0777 system system</span> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span>chmod 777 /dev/device-pm</div> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>(2)启动加入的进程</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>还是在android2.3.4_GB_T34\out\target\product\smdkc110\root\init.rc中</div> <div style="line-height:25px"> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span># start memsicd service</div> <div style="line-height:25px"><span style="color:#ff0000; line-height:25px"><span style="line-height:25px; white-space:pre"></span>service memsicd /system/bin/memsicd</span></div> <div style="line-height:25px"><span style="color:#ff0000; line-height:25px"> <span style="line-height:25px; white-space:pre"> </span>oneshot</span></div> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"><span style="color:#ff0000; line-height:25px"></span></span>这样就可以了。在adb shell下,ps查看下进程,看下有没有这个:</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>/system/bin/memsicd</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>如果这个有的话,再:</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>#cd /data/misc/sensors</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span># ls</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>看下有没有accel_offset这个文件,如果有的话,这样就好了,试一下有没有方向变化。</div> <div style="line-height:25px">=======================================================================================</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"><span style="line-height:25px"></span></span><span style="line-height:25px">做完前面的,我的还有一个问题:在应用程序里面可以旋转(android2.3支持360度,如果是android2.2的话,可以参考其它的方法),但是在Launcher里面不会旋转呀,请教下我们做应用的同事,人家说Launcher里面有个值被设成 android:screenOrientation="nosensor",改下这里就好了。</span> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>3,Launcher中旋转的方法</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>在android2.3.4_GB_T34\packages\apps\Launcher2\AndroidManifest.xml里面有两个</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"> </span> android:screenOrientation=<span style="color:#ff0000; line-height:25px">"nosensor"</span> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>改成</div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>android:screenOrientation=<span style="color:#99cc00; line-height:25px">"sensor"</span> </div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>上面的问题也解决。</div> <div style="line-height:25px"><br style="line-height:25px"></div> <div style="line-height:25px"> <span style="line-height:25px; white-space:pre"></span>以上在实践中得到的,理论上的东西也许说的不清楚,希望对在工作中有相同问题的朋友有所帮助!</div> </wbr>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值