Android 中三星 Galaxy S2 的 USB 外设驱动程序集成

发布于 2024-12-01 17:12:14 字数 488 浏览 1 评论 0原文

我有一个 USB 设备(指纹读取器),我将其连接到 Galaxy S2(因为它支持 USB 主机模式),并在我自己的应用程序中使用它,利用最新的 Android USB API http://developer.android.com/reference/android/hardware/usb/UsbDevice.html

当我连接读者至手机上显示“未知USB外围设备”,并且读卡器已打开,因此不存在电源问题。 我有阅读器的Linux驱动源代码,所以如果需要的话我可以将其编译为ARM架构。

我怎样才能把这个驱动程序集成到Android内核中(如果可能的话,因为它是基于Linux的)?可以创建一个单独的模块吗? root权限是绝对需要的吗?

或者更简单,我可以通过 USB API 确定外设类型吗?

i have a USB device (fingerprint reader) which I'd connect to the Galaxy S2 (since it supports USB host mode) and use it in my own app exploiting newest Android USB APIs http://developer.android.com/reference/android/hardware/usb/UsbDevice.html

When I connect the reader to the phone, it says "unknown USB peripheral device" and the reader is switched on, so there is no power supply problem.
I have the Linux driver source code of the reader, so I can compile it for ARM architecture if necessary.

How can I integrate this driver in the Android kernel (if possible, since it is based on Linux)?? Is possible to create a separate module?? root privileges are absolutely needed?

Or simpler maybe, can I determine the peripheral type through the USB APIs??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南城追梦 2024-12-08 17:12:14

我知道 API 可能不兼容。
但由于 Galaxy 本身支持 USB Host 模式,也许没有问题......

但是,关于使用单独的模块将驱动程序集成到内核中,是否有一个指南解释该过程?

I know there could be an incompatibility with the APIs.
But since Galaxy natively supports USB Host mode maybe there is no problem...

However, regarding the driver integration into the kernel with a separate module, is there a guide which explains the procedure?

糖果控 2024-12-08 17:12:14

您可以在此处找到集成指南:
http://android.serverbox.ch/?p=285

虽然这个例子展示了如何为 Honeycomb 编译 ftdi 驱动程序,它可以帮助您入门。

You can find a guide for the integration here:
http://android.serverbox.ch/?p=285

Though this example shows how to compile a ftdi driver for Honeycomb, it could get you started.

我喜欢麦丽素 2024-12-08 17:12:14

您必须将 Linux 驱动程序编译为模块才能获得“fingerprintdriver.ko”。使用 ARM 交叉编译器,就像使用 linux 2.6.35(版本取决于您的 Android 版本)驱动程序一样。现在,我在博客上看到,您应该从 Android 工具包中获取 ARM 编译器,因为其中存在细微差别,有时会产生影响,但我自己从未尝试过,因为我使用的是 Android 提供的编译器开发套件。然后您将使用命令“insmod /modules/fingerprintdriver.ko”安装它。您还应该将其放入“init.rc”文件中,以便它在启动时自行安装。但根据驱动程序的不同,Android API 可能看不到(很可能看不到)。如果这是您想要的,您将必须编写一段代码以使设备被视为例如“传感器”。然后您的设备将可供整个 Android 程序员社区使用。如果您只想将其用于您自己的目的,而不是供整个 Android 应用程序程序员社区使用,您可能只想通过 USB API 使用它。为你减少了很多工作。

希望这一小段信息对您有所帮助。

You will have to compile your linux driver as a module to get a "fingerprintdriver.ko". Do exactly as if it was a linux 2.6.35 (version depends on your Android version) driver with the ARM cross compiler. Now, I've seen on blogs that you should get the ARM compiler from the Android tool kit since there is a small difference in it that sometimes make a difference but I never tried it myself since I'm using the one provided with the Android Dev kit. Then you will install it with the command "insmod /modules/fingerprintdriver.ko". You should also put it in the "init.rc" file so it installs itself at boot time. But depending on the driver, it might not (most likely not) be seen by the Android API. If it's what you want, you will have to write the piece of code to get the device to be seen as, for example, a "sensor". Then your device would get available to the whole community of Android programmer. If you just want to use it just for your own purpose and not by the whole Android app programmer community, you probably just want to use it through the USB API. Much less work for you.

Hope that little piece of info is of some help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文