chrome.usb.bulkTransfer如何从DigitalPersona指纹识别器中读取?

时间:2014-07-03 05:19:58

标签: usb google-chrome-app

我试图从DigitalPersona指纹识别器读取指纹。

跟着api app_usb#bulk_transfers,我写了代码:

//ignore the findDevice() part

var transferInfo = {
    "direction": "in",
    "endpoint": 3, //don't know where to find device protocol, 3 is a random number.
    "length": 318
}
chrome.usb.bulkTransfer(connectionHandle, transferInfo, function(event){
    console.log("got " + event.data.byteLength + " bytes");
});

但我的结果是“得到0字节”。为什么呢?

1 个答案:

答案 0 :(得分:1)

要获得正确的端点,您应该调用#!/usr/bin/env bash export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH export LMDCRON=1 . /usr/local/maldetect/conf.maldet if [ -f "/usr/local/maldetect/conf.maldet.cron" ]; then . /usr/local/maldetect/conf.maldet.cron fi find=`which find 2> /dev/null` if [ "$find" ]; then # prune any quarantine/session/tmp data older than 7 days tmpdirs="/usr/local/maldetect/tmp /usr/local/maldetect/sess /usr/local/maldetect/quarantine /usr/local/maldetect/pub" for dir in $tmpdirs; do if [ -d "$dir" ]; then $find $dir -type f -mtime +7 -print0 | xargs -0 rm -f >> /dev/null 2>&1 fi done fi if [ "$autoupdate_version" == "1" ] || [ "$autoupdate_signatures" == "1" ]; then # sleep for random 1-999s interval to better distribute upstream load sleep $(echo $RANDOM | cut -c1-3) >> /dev/null 2>&1 fi if [ "$autoupdate_version" == "1" ]; then # check for new release version /usr/local/maldetect/maldet -d >> /dev/null 2>&1 fi if [ "$autoupdate_signatures" == "1" ]; then # check for new definition set /usr/local/maldetect/maldet -u >> /dev/null 2>&1 fi ... 函数。

结果将是一个具有名为 interfaces 的属性的对象。

如果您枚举找到的接口,您将为每个接口找到一个名为端点的属性,该属性枚举可用的接口。

根据您想要的通信渠道选择端点:

  • in / out
  • 批量/中断/ ...

然后,获取其地址属性,以填充chrome.usb.getConfiguration函数调用的GenericTransferInfo 端点属性。

bulkTransfer