我有一个使用Android系统运行的设备(gsensor,MPU6050)。 我无法直接构建它,因为3.4内核不存在它,但我想知道我是否可以为我的设备修改MPU3050驱动程序。
我找到了readme,但我想知道它是否有效?
修改:完成一半工作*后,这里是dmesg
的一部分:
<7>[ 13.283019] i2c-core: driver [mpu3050] registered
<6>[ 13.283119] init: command 'insmod' r=0
<4>[ 13.312403] industrialio: module is from the staging directory, the quality is unknown, you have been warned.
<6>[ 13.315656] init: command 'insmod' r=0
<4>[ 13.320725] kfifo_buf: module is from the staging directory, the quality is unknown, you have been warned.
<6>[ 13.321687] init: command 'insmod' r=0
<4>[ 13.329837] ring_sw: module is from the staging directory, the quality is unknown, you have been warned.
<6>[ 13.330847] init: command 'insmod' r=0
<6>[ 13.354793] hub 4-0:1.0: [hub_activate 872]
<4>[ 13.392922] inv_mpu_iio: module is from the staging directory, the quality is unknown, you have been warned.
<7>[ 13.395860] i2c-core: driver [inv-mpu-iio] registered
i2ctools检测到这一点:
# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU UU UU UU UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdump -f -y 2 0x68
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 89 75 81 e1 1e 0f fb 1e fe 8d 00 a8 28 51 50 b9 ?u????????.?(QP?
10: 86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 ...........@....
70: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 .....h..........
80: 89 75 81 e1 1e 0f fb 1e fe 8d 00 a8 28 51 50 b9 ?u????????.?(QP?
90: 86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 ...........@....
f0: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 .....h..........
# i2cget -f -y 2 0x68
0x75
# i2cget -f -y 2 0x68
0xe1
# i2cget -f -y 2 0x68
0x0f
# i2cget -f -y 2 0x68
0x1e
# i2cget -f -y 2 0x68
0x8d
#
*只是编译了驱动程序,内核还没有被修改。以下here。
答案 0 :(得分:1)
是的,你可以。
请参阅数据表,了解每个设备的功能和寄存器之间的差异,但我相信你会发现mpu-6050是mpu-3050的超集,所以扩展一个驱动程序以容纳另一个应该是一个简单的例子编程案例。
你问的问题在这里是不合适的 - 存在Stackoverflow以提供特定问题的帮助你没有说明任何实际问题,除了想知道是否可能,上面给出的答案是肯定的,只要您完成工作并从可用资源中学习。