FT9338指纹移植笔记

一、驱动Porting
①xxx_defconfig


CONFIG_MTK_SPI=y


②dws配置
四个dct/dct/codegen.dws
添加自定义变量名,以便dws可以选择
dct/EINT_YuSu.cmp
dct/GPIO_YuSu.cmp



③驱动调试
驱动定义好相关引脚
#define GPIO_FOCAL_FP_RST_PIN               GPIO_FP_RST_PIN   //gpio3
#define GPIO_FP_INT_PIN (GPIO63 | 0x80000000)//dws not config gpio name




static int mt_spi_gpio_set(void)
{


mt_set_gpio_mode(GPIO_SPI_CS_PIN, SPI_CS_PIN_MODE);
mt_set_gpio_dir(GPIO_SPI_CS_PIN, GPIO_DIR_OUT);
mt_set_gpio_pull_enable(GPIO_SPI_CS_PIN, GPIO_PULL_ENABLE);
mt_set_gpio_pull_select(GPIO_SPI_CS_PIN,GPIO_PULL_UP);


mt_set_gpio_mode(GPIO_SPI_SCK_PIN, SPI_SCK_PIN_MODE);
mt_set_gpio_dir(GPIO_SPI_SCK_PIN, GPIO_DIR_OUT);
mt_set_gpio_pull_enable(GPIO_SPI_SCK_PIN, GPIO_PULL_ENABLE);
mt_set_gpio_pull_select(GPIO_SPI_SCK_PIN,GPIO_PULL_DOWN);


mt_set_gpio_mode(GPIO_SPI_MISO_PIN, SPI_MISO_PIN_MODE);
mt_set_gpio_dir(GPIO_SPI_MISO_PIN, GPIO_DIR_IN);
mt_set_gpio_pull_enable(GPIO_SPI_MISO_PIN, GPIO_PULL_ENABLE);
mt_set_gpio_pull_select(GPIO_SPI_MISO_PIN,GPIO_PULL_DOWN)
;
mt_set_gpio_mode(GPIO_SPI_MOSI_PIN, SPI_MOSI_PIN_MODE);
mt_set_gpio_dir(GPIO_SPI_MOSI_PIN, GPIO_DIR_OUT);
mt_set_gpio_pull_enable(GPIO_SPI_MOSI_PIN, GPIO_PULL_ENABLE);
mt_set_gpio_pull_select(GPIO_SPI_MOSI_PIN,GPIO_PULL_DOWN);
//ready 
#if 1
        mt_set_gpio_mode(GPIO_FP_INT_PIN, SPI_INT_PIN_MODE);
mt_set_gpio_dir(GPIO_FP_INT_PIN, GPIO_DIR_IN);
//mt_set_gpio_pull_enable(GPIO_FP_INT_PIN, GPIO_PULL_ENABLE);
//mt_set_gpio_pull_select(GPIO_FP_INT_PIN,GPIO_PULL_UP);
#endif
        return 0;
}


focal_fp_sensor_probe
     mt_spi_gpio_set();


ioctl()  上层需要查询中断脚状态
case FOCAL_FP_GET_MCU_STATUS:
             g_fpmcustatus = mt_get_gpio_in(GPIO_FP_INT_PIN);




focal_fp_fw_download 检查固件download是否成功,若成功,驱动基本可以工作了。




二、打开"设置"指纹解锁功能
①编译内置相关库
1、AliFingerService.apk    ---->/system/app
2、libmtk_fpclient_lib.so  ----->/system/lib
3、libftalg.so  -------------------->/system/lib
4、fp_native_service  ----------->/system/bin
5、libfpsdk.so    ------------------>/system/lib
6、sepolicy权限,eng调试可以手动setenforce 0


device/alibaba/common/device.mk


 
+YUNOS_SUPPORT_ALIFP_CHIP ?= NONE
+$(warning ************Compiled fingerprint chip: $(YUNOS_SUPPORT_ALIFP_CHIP) ***********)
+ifeq ($(YUNOS_SUPPORT_ALIFP_CHIP),FocalTech)
+YUNOS_SUPPORT_ALIFP := true
+PRODUCT_PACKAGES += AliFingerService  //aliyunos/yunospick/prebuilts/app/AliFingerService.apk、Android.mk
+PRODUCT_COPY_FILES += device/alibaba/common/fingerprint/fp_native_service:system/bin/fp_native_service
+PRODUCT_COPY_FILES += device/alibaba/common/fingerprint/libmtk_fpclient_lib.so:system/lib/libmtk_fpclient_lib.so
+PRODUCT_COPY_FILES += device/alibaba/common/fingerprint/libfpsdk.so:system/lib/libfpsdk.so
+PRODUCT_COPY_FILES += device/alibaba/common/fingerprint/libftalg.so:system/lib/libftalg.so
+endif
+


对应项目device.mk 配置开关
device/alibaba/xxx/device.mk
+#support fingerprint
+YUNOS_SUPPORT_ALIFP_CHIP := FocalTech
+
②设置服务及权限
device/alibaba/common/init.yunos.rc
+#fingerprint native service
+on post-fs
+    chown  system system /dev/focal_fp
+    chown  system system /system/bin/fp_native_service
+
+service fingerprint /system/bin/fp_native_service
+    class core
+    user root
+    group root




device/mediatek/common/sepolicy/device.te
device/mediatek/common/sepolicy/file_contexts
device/mediatek/common/sepolicy/fingerprint.te
device/mediatek/common/sepolicy/service.te
device/mediatek/common/sepolicy/service_contexts
device/mediatek/common/sepolicy/system_server.te




三、工作逻辑及调试技巧


①工作逻辑
包括指纹录入及指纹解锁


设置-添加指纹-完成指纹录入


锁屏按指纹-中断上报uevent事件-上层接收事件进行图像匹配解锁


②测试驱动是否正常工作
irq_test   =========  测试中断脚是否变化
uevent_test  =========  测试uevent是否上报
uevent_get  =========   测试uevent是否正常接收,路径很关键,可以字符串匹配方式



发布了154 篇原创文章 · 获赞 12 · 访问量 52万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览