Webusb扫描文件 [英] Webusb to scan documents

查看:183
本文介绍了Webusb扫描文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人成功配置了webusb来扫描文档?我能够连接到USB扫描仪,但无法找到任何关于扫描文档的命令的文档:

$ lsusb -v

 总线001设备007:ID 1083:163e Canon Electronics,Inc. 
设备描述符:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0(定义在接口级别)
bDeviceSubClass 0
bDeviceProtocol 1
bMaxPacketSize0 64
idVendor 0x1083 Canon Electronics,Inc.
idProduct 0x163e
bcdDevice 2.02
iManufacturer 1 CANON
iProduct 2 CANON DR-M160
iSerial 0
bNumConfigurations 1
配置描述符:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurat ionValue 1
iConfiguration 0
bmAttributes 0xc0
自供电
MaxPower 98mA
接口描述符:
bLength 9
bDescriptorType 4
b接口编号0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 0(定义于接口级)
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
端点描述符:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
传输类型批量
同步类型无
使用类型数据
wMaxPacketSize 0x0200 1x 512字节
bInterval 0
端点描述符:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
传输类型批量
同步类型无
使用类型数据
wMaxPacketSize 0x0200 1x 512字节
bInterval 0
端点描述符:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
传输类型中断
同步类型无
使用类型数据
wMaxPacketSize 0x0040 1x 64字节
间隔6
设备限定符(用于其他设备速度):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (定义在接口级别)
bDeviceSubClass 0
bDeviceProtocol 1
bMaxPacketSize0 64
bNumConfigurations 1
设备状态:0x0001
自动驱动

下面的代码测试低级别的传输,但即使PromiseStatus标记为已解决,状态仍然失效,device.transferIn状态保留悬而未决。我无法继续前进,因为我没有找到任何有关我的扫描仪或任何其他扫描仪的文档。

  navigator。 usb.requestDevice({filters:[{vendorId:0x1083}]})
.then(selectedDevice => {
device = selectedDevice;
return device.open(); // Begin (()=> device.selectConfiguration(1))
.then(()=> device.claimInterface(0))
.then(()=> device.controlTransferOut({
requestType:'vendor',
recipient:'device',
request:0x22,
value:0x01,
index:0x01}))
.then(()=> device.transferIn(1,64))//等待来自端点#1的64个字节的数据。
.then(result => {
let decoder = new TextDecoder();
console.log('Received:'+ decoder.decode(result.data));
})
.catch(error => {console.log(error);});

谢谢!

解决方案

 <$ c $ 

我试图通过WebUSB扫描CanoScan LiDE 25,它使用plustek芯片。 c> // http://www.linux-usb.org/usb.ids
// 04a9 Canon,Inc.
// 2200 CanoScan LiDE 25
navigator.usb.requestDevice( (过滤器:[{vendorId:0x04a9}]})
.then(device => {
console.log(device.productName); //CanonScan
console.log device.manufacturerName); //Canon
})
.catch(error => {console.log(error);});

我目前尝试使用wireshark和USBMon对协议进行逆向工程。理智家伙已经做到了这一点(



在上图中,您可以看到Wireshark和命令的追踪:

  export SANE_DEBUG_DLL = 255#已启用调试日志记录为
scanimage -p --resolution 150 --mode Gray -x 210 -y 297> image.pnm

这并不能回答你的问题。尽管如此,它仍然显示出前进的方向。



我希望最具创新性的东西是用emscripten( https://github.com/kripken/emscripten )转换为javascript,然后直接使用它。



<当启用plustek驱动程序的调试日志时,以下是一些更多的调试输出:

  $ export SANE_DEBUG_PLUSTEK = 12 
$ scanimage -L
[sanei_debug]将dll的调试级别设置为0.
[sanei_debug]将plustek的调试级别设置为12.
[plustek] Plustek后端V0.52-12 ,部分理智后端1.0.25git
[plustek]检索所有支持和连接的设备
[plustek]可用和支持的设备:
[plustek]设备:> libusb:001:008<< ; - 0x04a9x0x2220
[plustek]>#Plustek-SANE后端配置文件<
[plustek]>#用于基于LM9831 / 2/3的USB扫描仪<
[plustek]>#<
[plustek]><
[plustek]>#每个设备至少需要两行:<
[plustek]># - [usb]供应商ID和产品ID<
[plustek]># - 设备设备名称<
[plustek]>#即对于Plustek(0x07B3)UT12 / 16/24(0x0017)<
[plustek]>#[usb] 0x07B3 0x0017<
[plustek]>#device / dev / usbscanner<
[plustek]>#或<
[plustek]>#device libusb:bbb:ddd<
[plustek]>#其中bbb是总线编号,ddd是器件编号<
[plustek]>#确保您的用户可以访问/ proc / bus / usb / bbb / ddd<
[plustek]>#<
[plustek]>#另外你可以指定一些选项<
[plustek]>#预热,10ffOnEnd,lampOff<
[plustek]>#<
[plustek]>#对于自动检测,使用<
[plustek]>#[usb]<
[plustek]>#device / dev / usbscanner<
[plustek]>#<
[plustek]>#或简单地<
[plustek]>#[usb]<
[plustek]>#<
[plustek]>#或者如果你想要一个特定的设备,但你不知道<
[plustek]>#设备节点,或者您使用libusb,只需设置供应商和产品ID<
[plustek]>#[usb] 0x07B3 0x0017<
[plustek]>#设备自动<
[plustek]>#<
[plustek]>#注意:自动检测是安全的,因为它使用它获得的信息<
[plustek]>#来自USB子系统。如果你没有使用<
[plustek]>#自动检测,您必须已经附加了该设备<
[plustek]>#在您的USB端口上,您已指定...<<
[plustek]>#<
[plustek]><
[plustek]> [usb]<
[plustek] next device uses autodetection
[plustek] ... next device
[plustek]><
[plustek]>#<
[plustek]>以前的USB条目的#个选项<
[plustek]>#<在xxx秒后关闭
[plustek]>#开关灯,0禁用特征<
[plustek]>#(也可以通过前端设置)<
[plustek]> option lampOff 300<
[plustek]解码选项> lampOff<
[plustek]><
[plustek]>#以秒为单位的暖机期,0表示不暖机,-1表示自动预热<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项预热-1<
[plustek]解码选项>热身<
[plustek]><
[plustek]>#0意味着保持灯状态不变,不是0意味着关闭<
[plustek]>#on sane_close<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项10ffOnEnd 1<
[plustek]解码选项> 10ffOnEnd<
[plustek]><
[plustek]>#<
[plustek]>#选项来调整图片的开始位置<
[plustek]>#(警告:没有内部范围检查!!!)<
[plustek]>#<
[plustek]>#对于正常扫描区域<
[plustek]>#<
[plustek]>选项posOffX 0<
[plustek]解码选项> posOffX<
[plustek]>选项posOffY 0<
[plustek]解码选项> posOffY<
[plustek]><
[plustek]>#用于透明胶片<
[plustek]>选项tpaOffX 0<
[plustek]解码选项> tpaOffX<
[plustek]>选项tpaOffY 0<
[plustek]解码选项> tpaOffY<
[plustek]><
[plustek]>#用于底片<
[plustek]>选项negOffX 0<
[plustek]解码选项> negOffX<
[plustek]>选项negOffY 0<
[plustek]解码选项> negOffY<
[plustek]><
[plustek]>#<
[plustek]>#用于设置校准条位置<
[plustek]>#(警告:没有内部范围检查!!!)<
[plustek]>#-1表示使用内置的<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项posShadingY -1<
[plustek]解码选项> posShadingY<
[plustek]>选项tpaShadingY -1<
[plustek]解码选项> tpaShadingY<
[plustek]>选项negShadingY -1<
[plustek]解码选项> negShadingY<
[plustek]><
[plustek]>#<
[plustek]>#来反转底片,0禁用特征<
[plustek]>#<
[plustek]>选项invertNegatives 0<
[plustek]解码选项> invertNegatives<
[plustek]><
[plustek]>#<
[plustek]>#禁用内部传感器加速功能,<
[plustek]>#1禁用特征<
[plustek]>#<
[plustek]>选项disableSpeedup 0<
[plustek]解码选项> disableSpeedup<
[plustek]><
[plustek]>#<
[plustek]>#保存/恢复粗略校准数据<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项cacheCalData 0<
[plustek]解码选项> cacheCalData<
[plustek]><
[plustek]>#<
[plustek]>#使用备用校准程序<
[plustek]>#<
[plustek]>选项altCalibration 0<
[plustek]解码选项> altCalibration<
[plustek]><
[plustek]>#<
[plustek]>#用于跳过整个校准步骤<
[plustek]>#<
[plustek]>选项skipCalibration 0<
[plustek]解码选项> skipCalibration<
[plustek]><
[plustek]>#<
[plustek]>#用于跳过整个精确校准步骤<
[plustek]>#粗略校准完成<
[plustek]>#<
[plustek]>选项skipFine 0<
[plustek]解码选项> skipFine<
[plustek]><
[plustek]>#<
[plustek]>#丢弃精细白色校准的结果<
[plustek]>#<
[plustek]>选项skipFineWhite 0<
[plustek]解码选项> skipFineWhite<
[plustek]><
[plustek]>#<
[plustek]>#一些扫描仪有一个黑暗的校准条,在<
[plustek]>#general这个应该用于校准。<
[plustek]>#因为这可能会导致一些麻烦,所以这个选项<
[plustek]>#覆盖那个,暗校准将是<
[plustek]>#通过关闭灯来完成<
[plustek]>#<
[plustek]>选项skipDarkStrip 0<
[plustek]解码选项> skipDarkStrip<
[plustek]><
[plustek]>#用于替换在粗略<
[plustek]>#校准<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_gain -1<
[plustek]解码选项> red_gain<
[plustek]> option green_gain -1<
[plustek]解码选项> green_gain<
[plustek]> option blue_gain -1<
[plustek]解码选项> blue_gain<
[plustek]><
[plustek]>#用于替换在粗略<
[plustek]>#校准<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_offset -1<
[plustek]解码选项> red_offset<
[plustek]>选项green_offset -1<
[plustek]解码选项> green_offset<
[plustek]> option blue_offset -1<
[plustek]解码选项> blue_offset<
[plustek]><
[plustek]>#<
[plustek]>#代替默认的灯泡设置,这个<
[plustek]>#仅适用于CIS设备,如CanoScan LiDE20<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_lampoff -1<
[plustek]解码选项> red_lampoff<
[plustek]> option green_lampoff -1<
[plustek]解码选项> green_lampoff<
[plustek]> option blue_lampoff -1<
[plustek]解码选项> blue_lampoff<
[plustek]><
[plustek]>#<
[plustek]>#用于调整默认伽玛值<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项redGamma 1.0<
[plustek]解码选项> redGamma<
[plustek]>选项greenGamma 1.0<
[plustek]解码选项> greenGamma<
[plustek]> option blueGamma 1.0<
[plustek]解码选项> blueGamma<
[plustek]>选项grayGamma 1.0<
[plustek]解码选项> grayGamma<
[plustek]><
[plustek]>#<
[plustek]>#启用TPA(如果自动检测失败,则为EPSON或UMAX)<
[plustek]>#0表示如在内部表中指定的默认行为<
[plustek]>#1表示启动(UMAX 3450需要)<
[plustek]>选项enableTPA 0<
[plustek]解码选项> enableTPA<
[plustek]><
[plustek]>#<
[plustek]>#模型覆盖功能,目前仅适用于<
[plustek]>#Mustek设备,使用NSC的供应商ID:0x0400和<
[plustek]>#它们的产品ID:0x1000(LM9831)0x1001(LM9832)<
[plustek]>#<
[plustek]>#mov / PID | 0x1000 | 0x1001<
[plustek]>#---------------------------------------< ;
[plustek]>#0(默认)| BearPaw1200 | BearPaw 2400<
[plustek]>#1 |忽略| BearPaw 1200<
[plustek]>#<
[plustek]>选项mov 0<
[plustek]解码选项> mov<
[plustek]><
[plustek]>#<
[plustek]>#,当然还有设备名称<
[plustek]>#<
[plustek]>#device / dev / usbscanner<
[plustek]>设备自动<
[plustek]解码设备名称>自动<
[plustek]><
[plustek]>#<
[plustek]>#来定义一个新设备,从一个新的部分开始:<
[plustek]>#[usb]<
[plustek]>#<
[plustek] attach(auto,0x7ffdc9adc760,(nil))
[plustek]设备配置:
[plustek]设备名称:> auto<
[plustek] USB-ID:><
[plustek]型号ovr。 :0
[plustek]热身:-1s
[plustek] lamp off:300
[plustek] lampOffOnEnd:yes
[plustek] cacheCalData:no
[plustek] altCalibrate:no
[plustek] skipCalibr。 :no
[plustek] skipFine:no
[plustek] skipFineWhite:no
[plustek] skipDarkStrip:no
[plustek] incDarkTarget:是
[plustek] invertNegs 。 :no
[plustek] dis.Speedup:no
[plustek] pos_x:0
[plustek] pos_y:0
[plustek] pos_shading_y:-1
[ plustek] neg_x:0
[plustek] neg_y:0
[plustek] neg_shading_y:-1
[plustek] tpa_x:0
[plustek] tpa_y:0
[plustek] tpa_shading_y:-1
[plustek]红色增益:-1
[plustek]绿色增益:-1
[plustek]蓝色增益:-1
[plustek]红色偏移:-1
[plustek]绿色偏移:-1
[plustek]蓝色偏移:-1
[plustek]红色指示灯:-1
[plustek]绿色指示灯:-1
[plustek] blue lampoff:-1
[plustek]红色伽马值:1.00
[plustek]绿色伽玛值:1.00
[plustek]蓝色伽玛值:1.00
[plustek]灰色Gamma:1.00
[plustek] ---------------------
[plustek] usbDev_open(auto,) - 0x5555ca4dbe90
[plustek]供应商ID = 0x04A9,产品ID = 0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x:找到LM9832 / 3
[plust ek] *将设备设置为空闲状态!
[plustek]检测到的供应商&产品ID:0x04A9-0x2220
[plustek]> 0x04A9-0x2220的设备描述<找到。
[plustek] usb_initDev(44x04a9,-1)
[plustek]设备WAF:0x00004002
[plustek]传输速率:1000000 Bytes / s
[plustek]设备标志: 0x00000000
[plustek]供应商调整为:> Canon<
[plustek] LAMP-STATUS:0x00000000(off)
[plustek]复位寄存器(-1) - 0x80
[plustek]复位后的MISC I / O:0x66,0x16,0x91
[plustek]校准文件名称设置为:
[plustek]> /home/manuel/.sane/Canon_CanoScan_LiDE25-coarse.cal<
[plustek]> /home/manuel/.sane/Canon_CanoScan_LiDE25-fine.cal<
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes = 6
[plustek] * PhyLines = 4
[plustek] * TotalBytes = 24
[plustek] * Scansteps = 72(9 * 1200/150)
[plustek] usb_SetScanParameters()完成。
[plustek] usbDev_getCaps()
[plustek]扫描仪信息:
[plustek]供应商:Canon
[plustek]型号:CanoScan LiDE25
[plustek]标志: 0x00000000
[plustek] drvclose()
[plustek] usbDev_stopScan()
[plustek] usbDev_ScanEnd(),start = 0,park = 0
[plustek] usbDev_close()
[plustek] attach:model => CanoScan LiDE25<
[plustek] sane_get_devices(0x7ffdc9ade8e0,0)
设备`plustek:libusb:001:008'是佳能CanoScan LiDE25平板扫描仪
[plustek] sane_exit
[plustek]关机被称为(dev-> fd = -1,libusb:001:008)
[plustek]等待扫描仪就绪...
[plustek]开关灯熄灭...
[加灯]灯泡状态:0x00000000(off)
[plustek]灯泡状态:0x00000000(关闭)
[plustek]灯泡定时器停止
$ b

这是扫描时的输出

  scanimage -p  - 分辨率150  - 模式灰色-x 210 -y 297> image.pnm 
[sanei_debug]设置dll的调试级别为0.
[sanei_debug]设置plustek的调试级别为12.
[plustek] Plustek后端V0.52-12,属于sane-backends 1.0.25git
[plustek]检索所有支持和连接的设备
[plustek]可用和支持的设备:
[plustek]设备:> libusb:001:008< - 0x04a9x0x2220
[plustek]>#Plustek-SANE后端配置文件<
[plustek]>#用于基于LM9831 / 2/3的USB扫描仪<
[plustek]>#<
[plustek]><
[plustek]>#每个设备至少需要两行:<
[plustek]># - [usb]供应商ID和产品ID<
[plustek]># - 设备设备名称<
[plustek]>#即对于Plustek(0x07B3)UT12 / 16/24(0x0017)<
[plustek]>#[usb] 0x07B3 0x0017<
[plustek]>#device / dev / usbscanner<
[plustek]>#或<
[plustek]>#device libusb:bbb:ddd<
[plustek]>#其中bbb是总线编号,ddd是器件编号<
[plustek]>#确保您的用户可以访问/ proc / bus / usb / bbb / ddd<
[plustek]>#<
[plustek]>#另外你可以指定一些选项<
[plustek]>#预热,10ffOnEnd,lampOff<
[plustek]>#<
[plustek]>#对于自动检测,使用<
[plustek]>#[usb]<
[plustek]>#device / dev / usbscanner<
[plustek]>#<
[plustek]>#或简单地<
[plustek]>#[usb]<
[plustek]>#<
[plustek]>#或者如果你想要一个特定的设备,但你不知道<
[plustek]>#设备节点,或者您使用libusb,只需设置供应商和产品ID<
[plustek]>#[usb] 0x07B3 0x0017<
[plustek]>#设备自动<
[plustek]>#<
[plustek]>#注意:自动检测是安全的,因为它使用它获得的信息<
[plustek]>#来自USB子系统。如果你没有使用<
[plustek]>#自动检测,您必须已经附加了该设备<
[plustek]>#在您的USB端口上,您已指定...<<
[plustek]>#<
[plustek]><
[plustek]> [usb]<
[plustek] next device uses autodetection
[plustek] ... next device
[plustek]><
[plustek]>#<
[plustek]>以前的USB条目的#个选项<
[plustek]>#<在xxx秒后关闭
[plustek]>#开关灯,0禁用特征<
[plustek]>#(也可以通过前端设置)<
[plustek]> option lampOff 300<
[plustek]解码选项> lampOff<
[plustek]><
[plustek]>#以秒为单位的暖机期,0表示不暖机,-1表示自动预热<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项预热-1<
[plustek]解码选项>热身<
[plustek]><
[plustek]>#0意味着保持灯状态不变,不是0意味着关闭<
[plustek]>#on sane_close<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项10ffOnEnd 1<
[plustek]解码选项> 10ffOnEnd<
[plustek]><
[plustek]>#<
[plustek]>#选项来调整图片的开始位置<
[plustek]>#(警告:没有内部范围检查!!!)<
[plustek]>#<
[plustek]>#对于正常扫描区域<
[plustek]>#<
[plustek]>选项posOffX 0<
[plustek]解码选项> posOffX<
[plustek]>选项posOffY 0<
[plustek]解码选项> posOffY<
[plustek]><
[plustek]>#用于透明胶片<
[plustek]>选项tpaOffX 0<
[plustek]解码选项> tpaOffX<
[plustek]>选项tpaOffY 0<
[plustek]解码选项> tpaOffY<
[plustek]><
[plustek]>#用于底片<
[plustek]>选项negOffX 0<
[plustek]解码选项> negOffX<
[plustek]>选项negOffY 0<
[plustek]解码选项> negOffY<
[plustek]><
[plustek]>#<
[plustek]>#用于设置校准条位置<
[plustek]>#(警告:没有内部范围检查!!!)<
[plustek]>#-1表示使用内置的<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项posShadingY -1<
[plustek]解码选项> posShadingY<
[plustek]>选项tpaShadingY -1<
[plustek]解码选项> tpaShadingY<
[plustek]>选项negShadingY -1<
[plustek]解码选项> negShadingY<
[plustek]><
[plustek]>#<
[plustek]>#来反转底片,0禁用特征<
[plustek]>#<
[plustek]>选项invertNegatives 0<
[plustek]解码选项> invertNegatives<
[plustek]><
[plustek]>#<
[plustek]>#禁用内部传感器加速功能,<
[plustek]>#1禁用特征<
[plustek]>#<
[plustek]>选项disableSpeedup 0<
[plustek]解码选项> disableSpeedup<
[plustek]><
[plustek]>#<
[plustek]>#保存/恢复粗略校准数据<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项cacheCalData 0<
[plustek]解码选项> cacheCalData<
[plustek]><
[plustek]>#<
[plustek]>#使用备用校准程序<
[plustek]>#<
[plustek]>选项altCalibration 0<
[plustek]解码选项> altCalibration<
[plustek]><
[plustek]>#<
[plustek]>#用于跳过整个校准步骤<
[plustek]>#<
[plustek]>选项skipCalibration 0<
[plustek]解码选项> skipCalibration<
[plustek]><
[plustek]>#<
[plustek]>#用于跳过整个精确校准步骤<
[plustek]>#粗略校准完成<
[plustek]>#<
[plustek]>选项skipFine 0<
[plustek]解码选项> skipFine<
[plustek]><
[plustek]>#<
[plustek]>#丢弃精细白色校准的结果<
[plustek]>#<
[plustek]>选项skipFineWhite 0<
[plustek]解码选项> skipFineWhite<
[plustek]><
[plustek]>#<
[plustek]>#一些扫描仪有一个黑暗的校准条,在<
[plustek]>#general这个应该用于校准。<
[plustek]>#因为这可能会导致一些麻烦,所以这个选项<
[plustek]>#覆盖那个,暗校准将是<
[plustek]>#通过关闭灯来完成<
[plustek]>#<
[plustek]>选项skipDarkStrip 0<
[plustek]解码选项> skipDarkStrip<
[plustek]><
[plustek]>#用于替换在粗略<
[plustek]>#校准<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_gain -1<
[plustek]解码选项> red_gain<
[plustek]> option green_gain -1<
[plustek]解码选项> green_gain<
[plustek]> option blue_gain -1<
[plustek]解码选项> blue_gain<
[plustek]><
[plustek]>#用于替换在粗略<
[plustek]>#校准<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_offset -1<
[plustek]解码选项> red_offset<
[plustek]>选项green_offset -1<
[plustek]解码选项> green_offset<
[plustek]> option blue_offset -1<
[plustek]解码选项> blue_offset<
[plustek]><
[plustek]>#<
[plustek]>#代替默认的灯泡设置,这个<
[plustek]>#仅适用于CIS设备,如CanoScan LiDE20<
[plustek]>#(也可以通过前端设置)<
[plustek]> option red_lampoff -1<
[plustek]解码选项> red_lampoff<
[plustek]> option green_lampoff -1<
[plustek]解码选项> green_lampoff<
[plustek]> option blue_lampoff -1<
[plustek]解码选项> blue_lampoff<
[plustek]><
[plustek]>#<
[plustek]>#用于调整默认伽玛值<
[plustek]>#(也可以通过前端设置)<
[plustek]>选项redGamma 1.0<
[plustek]解码选项> redGamma<
[plustek]>选项greenGamma 1.0<
[plustek]解码选项> greenGamma<
[plustek]> option blueGamma 1.0<
[plustek]解码选项> blueGamma<
[plustek]>选项grayGamma 1.0<
[plustek]解码选项> grayGamma<
[plustek]><
[plustek]>#<
[plustek]>#启用TPA(如果自动检测失败,则为EPSON或UMAX)<
[plustek]>#0表示如在内部表中指定的默认行为<
[plustek]>#1表示启动(UMAX 3450需要)<
[plustek]>选项enableTPA 0<
[plustek]解码选项> enableTPA<
[plustek]><
[plustek]>#<
[plustek]>#模型覆盖功能,目前仅适用于<
[plustek]>#Mustek设备,使用NSC的供应商ID:0x0400和<
[plustek]>#它们的产品ID:0x1000(LM9831)0x1001(LM9832)<
[plustek]>#<
[plustek]>#mov / PID | 0x1000 | 0x1001<
[plustek]>#---------------------------------------< ;
[plustek]>#0(默认)| BearPaw1200 | BearPaw 2400<
[plustek]>#1 |忽略| BearPaw 1200<
[plustek]>#<
[plustek]>选项mov 0<
[plustek]解码选项> mov<
[plustek]><
[plustek]>#<
[plustek]>#,当然还有设备名称<
[plustek]>#<
[plustek]>#device / dev / usbscanner<
[plustek]>设备自动<
[plustek]解码设备名称>自动<
[plustek]><
[plustek]>#<
[plustek]>#来定义一个新设备,从一个新的部分开始:<
[plustek]>#[usb]<
[plustek]>#<
[plustek] attach(auto,0x7ffeffed9fa0,(nil))
[plustek]设备配置:
[plustek]设备名称:> auto<
[plustek] USB-ID:><
[plustek]型号ovr。 : 0
[plustek] warmup : -1s
[plustek] lampOff : 300
[plustek] lampOffOnEnd : yes
[plustek] cacheCalData : no
[plustek] altCalibrate : no
[plustek] skipCalibr. : no
[plustek] skipFine : no
[plustek] skipFineWhite: no
[plustek] skipDarkStrip: no
[plustek] incDarkTarget: yes
[plustek] invertNegs. : no
[plustek] dis.Speedup : no
[plustek] pos_x : 0
[plustek] pos_y : 0
[plustek] pos_shading_y: -1
[plustek] neg_x : 0
[plustek] neg_y : 0
[plustek] neg_shading_y: -1
[plustek] tpa_x : 0
[plustek] tpa_y : 0
[plustek] tpa_shading_y: -1
[plustek] red gain : -1
[plustek] green gain : -1
[plustek] blue gain : -1
[plustek] red offset : -1
[plustek] green offset : -1
[plustek] blue offset : -1
[plustek] red lampoff : -1
[plustek] green lampoff: -1
[plustek] blue lampoff : -1
[plustek] red Gamma : 1.00
[plustek] green Gamma : 1.00
[plustek] blue Gamma : 1.00
[plustek] gray Gamma : 1.00
[plustek] ---------------------
[plustek] usbDev_open(auto,) - 0x55e6fbc6e5a0
[plustek] Vendor ID=0x04A9, Product ID=0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x: found LM9832/3
[plust ek] * setting device to idle state!
[plustek] Detected vendor & product ID: 0x04A9-0x2220
[plustek] Device description for >0x04A9-0x2220<找到。
[plustek] usb_initDev(43,0x04a9,-1)
[plustek] Device WAF : 0x00004002
[plustek] Transferrate: 1000000 Bytes/s
[plustek] Device Flags: 0x00000000
[plustek] Vendor adjusted to: >Canon<
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] RESETTING REGISTERS(-1) - 0x80
[plustek] MISC I/O after RESET: 0x66, 0x16, 0x91
[plustek] Calibration file-names set to:
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-coarse.cal<
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-fine.cal<
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes = 6
[plustek] * PhyLines = 4
[plustek] * TotalBytes = 24
[plustek] * Scansteps=72 (9*1200/150)
[plustek] usb_SetScanParameters() done.
[plustek] usbDev_getCaps()
[plustek] Scanner information:
[plustek] Vendor : Canon
[plustek] Model : CanoScan LiDE25
[plustek] Flags : 0x00000000
[plustek] drvclose()
[plustek] usbDev_stopScan()
[plustek] usbDev_ScanEnd(), start=0, park=0
[plustek] usbDev_close()
[plustek] attach: model = >CanoScan LiDE25<
[plustek] sane_get_devices (0x7ffeffedc120, 0)
[plustek] sane_open - libusb:001:008
[plustek] Presetting Gamma tables (len=4096)
[plustek] * Channel[0], gamma 2.000
[plustek] * Channel[1], gamma 2.000
[plustek] * Channel[2], gamma 2.000
[plustek] * Channel[3], gamma 2.000
[plustek] ----------------------------------
[plustek] sane_start
[plustek] usbDev_open(libusb:001:008,) - (nil)
[plustek] Vendor ID=0x04A9, Product ID=0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x: found LM9832/3
[plustek] Detected vendor & product ID: 0x04A9-0x2220
[plustek] Device description for >0x04A9-0x2220<找到。
[plustek] usb_initDev(43,0x04a9,43)
[plustek] Device WAF : 0x00004002
[plustek] Transferrate: 1000000 Bytes/s
[plustek] Device Flags: 0x00000006
[plustek] Vendor adjusted to: >Canon<
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] RESETTING REGISTERS(43) - 0x80
[plustek] MISC I/O after RESET: 0x66, 0x16, 0x91
[plustek] usbDev_getCaps()
[plustek] scanmode = 1
[plustek] usbDev_getCropInfo()
[plustek] usb_GetImageInfo()
[plustek] PPL = 1240
[plustek] LPA = 1753
[plustek] BPL = 1240
[plustek] brightness 0, contrast 0
[plustek] usbDev_setScanEnv()
[plustek] usb_SaveImageInfo()
[plustek] * dwFlag = 0x00000400
[plustek] usb_GetImageInfo()
[plustek] * Preview Mode NOT set!
[plustek] Setting map[3] at 0x55e6fbcf7254
[plustek] usbDev_startScan()
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] Switching Lamp on
[plustek] Warmup-Timer started
[plustek] LAMP-STATUS: 0x00000001 (on)
[plustek] Lamp-Timer stopped
[plustek] dwflag = 0x40000400 dwBytesLine = 1240
[plustek] Lines = 1753
[plustek] Bytes per Line = 1240
[plustek] Bitdepth = 8
[plustek] TIME START
[plustek] local_sane_start done
[plustek] reader_process started (as thread)
[plustek] reader_process:starting to READ data (2173720 bytes)
[plustek] buf = 0x7f1864447010
[plustek] usbDev_PrepareScan()
[plustek] sane_start done
[plustek] cano_DoCalibration()
[plustek] #########################
[plustek] usb_SpeedTest(43,1000000)
[plustek] GETMCLK[10/1], using entry 8: 12.000, 1200
[plustek] SETMCLK[10/1]: 12.000
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDi vider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes = 30606
[plustek] * PhyLines = 1
[plustek] * TotalBytes = 30606
[plustek] usb_SetScanParameters() done.
[plustek] usb_ScanBegin()
[plustek] usb_DownloadShadingData(1)
[plustek] usb_ScanBegin() done.
[plustek] usb_IsDataAvailableInDRAM()
[plustek] Data is available
[plustek] usbDev_ScanEnd(), start=1, park=0
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes = 30606
[plustek] * PhyLines = 1
[plustek] * TotalBytes = 30606
[plustek] usb_SetScanParameters() done.
[plustek] usb_ScanBegin()
[plustek] usb_DownloadShadingData(1)
[plustek] usb_ScanBegin() done.
[plustek] usb_IsDataAvailableInDRAM()
[plustek] Data is available
[plustek] usbDev_ScanEnd(), start=1, park=0
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()...

Hope that helps a little bit
Manuel


Anybody had successfully configured webusb to scan a document ? I am able to connect to the usb scanner but wasn't able to find any documentation on commands to scan documents :

$lsusb -v

Bus 001 Device 007: ID 1083:163e Canon Electronics, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         1 
  bMaxPacketSize0        64
  idVendor           0x1083 Canon Electronics, Inc.
  idProduct          0x163e 
  bcdDevice            2.02
  iManufacturer           1 CANON   
  iProduct                2 CANON   DR-M160         
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               6
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         1 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

The code below test a low level transfer, however even the PromiseStatus is marked as resolved, status is stall and device.transferIn status remain pending. I wasn't able to go further as I didn't find any documentation for my scanner or any other scanner.

navigator.usb.requestDevice({ filters: [{ vendorId: 0x1083 }] })
.then(selectedDevice => {
   device = selectedDevice;
   return device.open(); // Begin a session.
 })
.then(() => device.selectConfiguration(1)) 
.then(() => device.claimInterface(0)) 
.then(() => device.controlTransferOut({
    requestType: 'vendor',
    recipient: 'device',
    request: 0x22,
    value: 0x01,
    index: 0x01})) 
.then(() => device.transferIn(1, 64)) // Waiting for 64 bytes of data from endpoint #1.
.then(result => {
  let decoder = new TextDecoder();
  console.log('Received: ' + decoder.decode(result.data));
})
.catch(error => { console.log(error); });

Thank you !

解决方案

I am trying to get scanning over WebUSB working with a CanoScan LiDE 25. It uses a plustek chip.

// http://www.linux-usb.org/usb.ids
// 04a9 Canon, Inc.
// 2200  CanoScan LiDE 25
navigator.usb.requestDevice({ filters: [{ vendorId: 0x04a9 }] })
.then(device => {
    console.log(device.productName);      // "CanonScan"
    console.log(device.manufacturerName); // "Canon"
})
.catch(error => { console.log(error); });

I currently try to reverse engineer the protocol with wireshark and USBMon. The guys from sane already did that (https://gitlab.com/sane-project/backends/blob/master/backend/plustek.c)

In the picture above you can see a trace with Wireshark and the command:

export SANE_DEBUG_DLL=255 # enabled debug logging for sane
scanimage -p --resolution 150 --mode Gray -x 210 -y 297 > image.pnm

This does not answer your question. Nevertheless it shows the way to go.

I would expect that the most innovate thing would be to compile sane with emscripten (https://github.com/kripken/emscripten) into javascript and then directly use it.

Here is some more debugging output, when enabling the debugging log of the plustek driver:

$ export SANE_DEBUG_PLUSTEK=12
$ scanimage -L
[sanei_debug] Setting debug level of dll to 0.
[sanei_debug] Setting debug level of plustek to 12.
[plustek] Plustek backend V0.52-12, part of sane-backends 1.0.25git
[plustek] Retrieving all supported and conntected devices
[plustek] Available and supported devices:
[plustek] Device: >libusb:001:008< - 0x04a9x0x2220
[plustek] ># Plustek-SANE Backend configuration file<
[plustek] ># For use with LM9831/2/3 based USB scanners<
[plustek] >#<
[plustek] ><
[plustek] ># each device needs at least two lines:<
[plustek] ># - [usb] vendor-ID and product-ID<
[plustek] ># - device devicename<
[plustek] ># i.e. for Plustek (0x07B3) UT12/16/24 (0x0017)<
[plustek] ># [usb] 0x07B3 0x0017<
[plustek] ># device /dev/usbscanner<
[plustek] ># or<
[plustek] ># device libusb:bbb:ddd<
[plustek] ># where bbb is the busnumber and ddd the device number<
[plustek] ># make sure that your user has access to /proc/bus/usb/bbb/ddd<
[plustek] >#<
[plustek] ># additionally you can specify some options<
[plustek] ># warmup, lOffOnEnd, lampOff<
[plustek] >#<
[plustek] ># For autodetection use<
[plustek] ># [usb]<
[plustek] ># device /dev/usbscanner<
[plustek] >#<
[plustek] ># or simply<
[plustek] ># [usb]<
[plustek] >#<
[plustek] ># or if you want a specific device but you have no idea about the<
[plustek] ># device node or you use libusb, simply set vendor- and product-ID<
[plustek] ># [usb] 0x07B3 0x0017<
[plustek] ># device auto<
[plustek] >#<
[plustek] ># NOTE: autodetection is safe, as it uses the info it got<
[plustek] >#       from the USB subsystem. If you're not using the<
[plustek] >#       autodetection, you MUST have attached that device<
[plustek] >#       at your USB-port, that you have specified...<
[plustek] >#<
[plustek] ><
[plustek] >[usb]<
[plustek] next device uses autodetection
[plustek] ... next device
[plustek] ><
[plustek] >#<
[plustek] ># options for the previous USB entry<
[plustek] >#<
[plustek] ># switch lamp off after xxx secs, 0 disables the feature<
[plustek] ># (can also be set via frontend)<
[plustek] >option lampOff 300<
[plustek] Decoding option >lampOff<
[plustek] ><
[plustek] ># warmup period in seconds, 0 means no warmup, -1 means auto-warmup<
[plustek] ># (can also be set via frontend)<
[plustek] >option warmup -1<
[plustek] Decoding option >warmup<
[plustek] ><
[plustek] ># 0 means leave lamp-status untouched, not 0 means switch off<
[plustek] ># on sane_close<
[plustek] ># (can also be set via frontend)<
[plustek] >option lOffOnEnd 1<
[plustek] Decoding option >lOffOnEnd<
[plustek] ><
[plustek] >#<
[plustek] ># options to tweak the image start-position<
[plustek] ># (WARNING: there's no internal range check!!!)<
[plustek] >#<
[plustek] ># for the normal scan area<
[plustek] >#<
[plustek] >option posOffX 0<
[plustek] Decoding option >posOffX<
[plustek] >option posOffY 0<
[plustek] Decoding option >posOffY<
[plustek] ><
[plustek] ># for transparencies<
[plustek] >option tpaOffX 0<
[plustek] Decoding option >tpaOffX<
[plustek] >option tpaOffY 0<
[plustek] Decoding option >tpaOffY<
[plustek] ><
[plustek] ># for negatives<
[plustek] >option negOffX 0<
[plustek] Decoding option >negOffX<
[plustek] >option negOffY 0<
[plustek] Decoding option >negOffY<
[plustek] ><
[plustek] >#<
[plustek] ># for setting the calibration strip position<
[plustek] ># (WARNING: there's no internal range check!!!)<
[plustek] ># -1 means use built in<
[plustek] ># (can also be set via frontend)<
[plustek] >option posShadingY -1<
[plustek] Decoding option >posShadingY<
[plustek] >option tpaShadingY -1<
[plustek] Decoding option >tpaShadingY<
[plustek] >option negShadingY -1<
[plustek] Decoding option >negShadingY<
[plustek] ><
[plustek] >#<
[plustek] ># to invert the negatives, 0 disables the feature<
[plustek] >#<
[plustek] >option invertNegatives 0<
[plustek] Decoding option >invertNegatives<
[plustek] ><
[plustek] >#<
[plustek] ># to disable the internal sensor speedup function,<
[plustek] ># 1 disables the feature<
[plustek] >#<
[plustek] >option disableSpeedup 0<
[plustek] Decoding option >disableSpeedup<
[plustek] ><
[plustek] >#<
[plustek] ># to save/restore coarse calibration data<
[plustek] ># (can also be set via frontend)<
[plustek] >option cacheCalData 0<
[plustek] Decoding option >cacheCalData<
[plustek] ><
[plustek] >#<
[plustek] ># use alternate calibration routines<
[plustek] >#<
[plustek] >option altCalibration 0<
[plustek] Decoding option >altCalibration<
[plustek] ><
[plustek] >#<
[plustek] ># for skipping whole calibration step<
[plustek] >#<
[plustek] >option skipCalibration 0<
[plustek] Decoding option >skipCalibration<
[plustek] ><
[plustek] >#<
[plustek] ># for skipping entire fine calibration step<
[plustek] ># coarse calibration is done<
[plustek] >#<
[plustek] >option skipFine 0<
[plustek] Decoding option >skipFine<
[plustek] ><
[plustek] >#<
[plustek] ># discard the result of the fine white calibration<
[plustek] >#<
[plustek] >option skipFineWhite 0<
[plustek] Decoding option >skipFineWhite<
[plustek] ><
[plustek] >#<
[plustek] ># some scanners have a dark calibration strip, in<
[plustek] ># general this one should be used for calibration.<
[plustek] ># As this could cause some trouble, this option<
[plustek] ># overrides that and the dark calibration will be<
[plustek] ># done by switching the lamp off<
[plustek] >#<
[plustek] >option skipDarkStrip 0<
[plustek] Decoding option >skipDarkStrip<
[plustek] ><
[plustek] ># for replacing the gain values found during coarse<
[plustek] ># calibration<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_gain   -1<
[plustek] Decoding option >red_gain<
[plustek] >option green_gain -1<
[plustek] Decoding option >green_gain<
[plustek] >option blue_gain  -1<
[plustek] Decoding option >blue_gain<
[plustek] ><
[plustek] ># for replacing the offset values found during coarse<
[plustek] ># calibration<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_offset   -1<
[plustek] Decoding option >red_offset<
[plustek] >option green_offset -1<
[plustek] Decoding option >green_offset<
[plustek] >option blue_offset  -1<
[plustek] Decoding option >blue_offset<
[plustek] ><
[plustek] >#<
[plustek] ># for replacing the default lampoff settings, this<
[plustek] ># works only for CIS devices like CanoScan LiDE20<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_lampoff   -1<
[plustek] Decoding option >red_lampoff<
[plustek] >option green_lampoff -1<
[plustek] Decoding option >green_lampoff<
[plustek] >option blue_lampoff  -1<
[plustek] Decoding option >blue_lampoff<
[plustek] ><
[plustek] >#<
[plustek] ># for adjusting the default gamma values<
[plustek] ># (can also be set via frontend)<
[plustek] >option redGamma         1.0<
[plustek] Decoding option >redGamma<
[plustek] >option greenGamma       1.0<
[plustek] Decoding option >greenGamma<
[plustek] >option blueGamma        1.0<
[plustek] Decoding option >blueGamma<
[plustek] >option grayGamma        1.0<
[plustek] Decoding option >grayGamma<
[plustek] ><
[plustek] >#<
[plustek] ># to enable TPA (EPSON or UMAX, if autodetection fails)<
[plustek] ># 0 means default behaviour as specified in the internal tables<
[plustek] ># 1 means enable (needed for UMAX 3450)<
[plustek] >option enableTPA 0<
[plustek] Decoding option >enableTPA<
[plustek] ><
[plustek] >#<
[plustek] ># model override functionality, currently only available for<
[plustek] ># Mustek devices, using NSCs' vendor ID: 0x0400 and<
[plustek] ># also their product ID: 0x1000 (LM9831) 0x1001 (LM9832)<
[plustek] >#<
[plustek] ># mov/PID    |    0x1000   |   0x1001<
[plustek] ># ---------------------------------------<
[plustek] ># 0 (default)| BearPaw1200 | BearPaw 2400<
[plustek] ># 1          |   ignored   | BearPaw 1200<
[plustek] >#<
[plustek] >option mov 0<
[plustek] Decoding option >mov<
[plustek] ><
[plustek] >#<
[plustek] ># and of course the device-name<
[plustek] >#<
[plustek] ># device /dev/usbscanner<
[plustek] >device auto<
[plustek] Decoding device name >auto<
[plustek] ><
[plustek] >#<
[plustek] ># to define a new device, start with a new section:<
[plustek] ># [usb]<
[plustek] >#<
[plustek] attach (auto, 0x7ffdc9adc760, (nil))
[plustek] Device configuration:
[plustek] device name  : >auto<
[plustek] USB-ID       : ><
[plustek] model ovr.   : 0
[plustek] warmup       : -1s
[plustek] lampOff      : 300
[plustek] lampOffOnEnd : yes
[plustek] cacheCalData : no
[plustek] altCalibrate : no
[plustek] skipCalibr.  : no
[plustek] skipFine     : no
[plustek] skipFineWhite: no
[plustek] skipDarkStrip: no
[plustek] incDarkTarget: yes
[plustek] invertNegs.  : no
[plustek] dis.Speedup  : no
[plustek] pos_x        : 0
[plustek] pos_y        : 0
[plustek] pos_shading_y: -1
[plustek] neg_x        : 0
[plustek] neg_y        : 0
[plustek] neg_shading_y: -1
[plustek] tpa_x        : 0
[plustek] tpa_y        : 0
[plustek] tpa_shading_y: -1
[plustek] red gain     : -1
[plustek] green gain   : -1
[plustek] blue gain    : -1
[plustek] red offset   : -1
[plustek] green offset : -1
[plustek] blue offset  : -1
[plustek] red lampoff  : -1
[plustek] green lampoff: -1
[plustek] blue lampoff : -1
[plustek] red Gamma    : 1.00
[plustek] green Gamma  : 1.00
[plustek] blue Gamma   : 1.00
[plustek] gray Gamma   : 1.00
[plustek] ---------------------
[plustek] usbDev_open(auto,) - 0x5555ca4dbe90
[plustek] Vendor ID=0x04A9, Product ID=0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x: found LM9832/3
[plustek]  * setting device to idle state!
[plustek] Detected vendor & product ID: 0x04A9-0x2220
[plustek] Device description for >0x04A9-0x2220< found.
[plustek] usb_initDev(43,0x04a9,-1)
[plustek] Device WAF  : 0x00004002
[plustek] Transferrate: 1000000 Bytes/s
[plustek] Device Flags: 0x00000000
[plustek] Vendor adjusted to: >Canon<
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] RESETTING REGISTERS(-1) - 0x80
[plustek] MISC I/O after RESET: 0x66, 0x16, 0x91
[plustek] Calibration file-names set to:
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-coarse.cal<
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-fine.cal<
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes   = 6
[plustek] * PhyLines   = 4
[plustek] * TotalBytes = 24
[plustek] * Scansteps=72 (9*1200/150)
[plustek] usb_SetScanParameters() done.
[plustek] usbDev_getCaps()
[plustek] Scanner information:
[plustek] Vendor : Canon
[plustek] Model  : CanoScan LiDE25
[plustek] Flags  : 0x00000000
[plustek] drvclose()
[plustek] usbDev_stopScan()
[plustek] usbDev_ScanEnd(), start=0, park=0
[plustek] usbDev_close()
[plustek] attach: model = >CanoScan LiDE25<
[plustek] sane_get_devices (0x7ffdc9ade8e0, 0)
device `plustek:libusb:001:008' is a Canon CanoScan LiDE25 flatbed scanner
[plustek] sane_exit
[plustek] Shutdown called (dev->fd=-1, libusb:001:008)
[plustek] Waiting for scanner-ready...
[plustek] Switching lamp off...
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] Lamp-Timer stopped

Here is the output when scanning

scanimage -p --resolution 150 --mode Gray -x 210 -y 297 > image.pnm
[sanei_debug] Setting debug level of dll to 0.
[sanei_debug] Setting debug level of plustek to 12.
[plustek] Plustek backend V0.52-12, part of sane-backends 1.0.25git
[plustek] Retrieving all supported and conntected devices
[plustek] Available and supported devices:
[plustek] Device: >libusb:001:008< - 0x04a9x0x2220
[plustek] ># Plustek-SANE Backend configuration file<
[plustek] ># For use with LM9831/2/3 based USB scanners<
[plustek] >#<
[plustek] ><
[plustek] ># each device needs at least two lines:<
[plustek] ># - [usb] vendor-ID and product-ID<
[plustek] ># - device devicename<
[plustek] ># i.e. for Plustek (0x07B3) UT12/16/24 (0x0017)<
[plustek] ># [usb] 0x07B3 0x0017<
[plustek] ># device /dev/usbscanner<
[plustek] ># or<
[plustek] ># device libusb:bbb:ddd<
[plustek] ># where bbb is the busnumber and ddd the device number<
[plustek] ># make sure that your user has access to /proc/bus/usb/bbb/ddd<
[plustek] >#<
[plustek] ># additionally you can specify some options<
[plustek] ># warmup, lOffOnEnd, lampOff<
[plustek] >#<
[plustek] ># For autodetection use<
[plustek] ># [usb]<
[plustek] ># device /dev/usbscanner<
[plustek] >#<
[plustek] ># or simply<
[plustek] ># [usb]<
[plustek] >#<
[plustek] ># or if you want a specific device but you have no idea about the<
[plustek] ># device node or you use libusb, simply set vendor- and product-ID<
[plustek] ># [usb] 0x07B3 0x0017<
[plustek] ># device auto<
[plustek] >#<
[plustek] ># NOTE: autodetection is safe, as it uses the info it got<
[plustek] >#       from the USB subsystem. If you're not using the<
[plustek] >#       autodetection, you MUST have attached that device<
[plustek] >#       at your USB-port, that you have specified...<
[plustek] >#<
[plustek] ><
[plustek] >[usb]<
[plustek] next device uses autodetection
[plustek] ... next device
[plustek] ><
[plustek] >#<
[plustek] ># options for the previous USB entry<
[plustek] >#<
[plustek] ># switch lamp off after xxx secs, 0 disables the feature<
[plustek] ># (can also be set via frontend)<
[plustek] >option lampOff 300<
[plustek] Decoding option >lampOff<
[plustek] ><
[plustek] ># warmup period in seconds, 0 means no warmup, -1 means auto-warmup<
[plustek] ># (can also be set via frontend)<
[plustek] >option warmup -1<
[plustek] Decoding option >warmup<
[plustek] ><
[plustek] ># 0 means leave lamp-status untouched, not 0 means switch off<
[plustek] ># on sane_close<
[plustek] ># (can also be set via frontend)<
[plustek] >option lOffOnEnd 1<
[plustek] Decoding option >lOffOnEnd<
[plustek] ><
[plustek] >#<
[plustek] ># options to tweak the image start-position<
[plustek] ># (WARNING: there's no internal range check!!!)<
[plustek] >#<
[plustek] ># for the normal scan area<
[plustek] >#<
[plustek] >option posOffX 0<
[plustek] Decoding option >posOffX<
[plustek] >option posOffY 0<
[plustek] Decoding option >posOffY<
[plustek] ><
[plustek] ># for transparencies<
[plustek] >option tpaOffX 0<
[plustek] Decoding option >tpaOffX<
[plustek] >option tpaOffY 0<
[plustek] Decoding option >tpaOffY<
[plustek] ><
[plustek] ># for negatives<
[plustek] >option negOffX 0<
[plustek] Decoding option >negOffX<
[plustek] >option negOffY 0<
[plustek] Decoding option >negOffY<
[plustek] ><
[plustek] >#<
[plustek] ># for setting the calibration strip position<
[plustek] ># (WARNING: there's no internal range check!!!)<
[plustek] ># -1 means use built in<
[plustek] ># (can also be set via frontend)<
[plustek] >option posShadingY -1<
[plustek] Decoding option >posShadingY<
[plustek] >option tpaShadingY -1<
[plustek] Decoding option >tpaShadingY<
[plustek] >option negShadingY -1<
[plustek] Decoding option >negShadingY<
[plustek] ><
[plustek] >#<
[plustek] ># to invert the negatives, 0 disables the feature<
[plustek] >#<
[plustek] >option invertNegatives 0<
[plustek] Decoding option >invertNegatives<
[plustek] ><
[plustek] >#<
[plustek] ># to disable the internal sensor speedup function,<
[plustek] ># 1 disables the feature<
[plustek] >#<
[plustek] >option disableSpeedup 0<
[plustek] Decoding option >disableSpeedup<
[plustek] ><
[plustek] >#<
[plustek] ># to save/restore coarse calibration data<
[plustek] ># (can also be set via frontend)<
[plustek] >option cacheCalData 0<
[plustek] Decoding option >cacheCalData<
[plustek] ><
[plustek] >#<
[plustek] ># use alternate calibration routines<
[plustek] >#<
[plustek] >option altCalibration 0<
[plustek] Decoding option >altCalibration<
[plustek] ><
[plustek] >#<
[plustek] ># for skipping whole calibration step<
[plustek] >#<
[plustek] >option skipCalibration 0<
[plustek] Decoding option >skipCalibration<
[plustek] ><
[plustek] >#<
[plustek] ># for skipping entire fine calibration step<
[plustek] ># coarse calibration is done<
[plustek] >#<
[plustek] >option skipFine 0<
[plustek] Decoding option >skipFine<
[plustek] ><
[plustek] >#<
[plustek] ># discard the result of the fine white calibration<
[plustek] >#<
[plustek] >option skipFineWhite 0<
[plustek] Decoding option >skipFineWhite<
[plustek] ><
[plustek] >#<
[plustek] ># some scanners have a dark calibration strip, in<
[plustek] ># general this one should be used for calibration.<
[plustek] ># As this could cause some trouble, this option<
[plustek] ># overrides that and the dark calibration will be<
[plustek] ># done by switching the lamp off<
[plustek] >#<
[plustek] >option skipDarkStrip 0<
[plustek] Decoding option >skipDarkStrip<
[plustek] ><
[plustek] ># for replacing the gain values found during coarse<
[plustek] ># calibration<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_gain   -1<
[plustek] Decoding option >red_gain<
[plustek] >option green_gain -1<
[plustek] Decoding option >green_gain<
[plustek] >option blue_gain  -1<
[plustek] Decoding option >blue_gain<
[plustek] ><
[plustek] ># for replacing the offset values found during coarse<
[plustek] ># calibration<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_offset   -1<
[plustek] Decoding option >red_offset<
[plustek] >option green_offset -1<
[plustek] Decoding option >green_offset<
[plustek] >option blue_offset  -1<
[plustek] Decoding option >blue_offset<
[plustek] ><
[plustek] >#<
[plustek] ># for replacing the default lampoff settings, this<
[plustek] ># works only for CIS devices like CanoScan LiDE20<
[plustek] ># (can also be set via frontend)<
[plustek] >option red_lampoff   -1<
[plustek] Decoding option >red_lampoff<
[plustek] >option green_lampoff -1<
[plustek] Decoding option >green_lampoff<
[plustek] >option blue_lampoff  -1<
[plustek] Decoding option >blue_lampoff<
[plustek] ><
[plustek] >#<
[plustek] ># for adjusting the default gamma values<
[plustek] ># (can also be set via frontend)<
[plustek] >option redGamma         1.0<
[plustek] Decoding option >redGamma<
[plustek] >option greenGamma       1.0<
[plustek] Decoding option >greenGamma<
[plustek] >option blueGamma        1.0<
[plustek] Decoding option >blueGamma<
[plustek] >option grayGamma        1.0<
[plustek] Decoding option >grayGamma<
[plustek] ><
[plustek] >#<
[plustek] ># to enable TPA (EPSON or UMAX, if autodetection fails)<
[plustek] ># 0 means default behaviour as specified in the internal tables<
[plustek] ># 1 means enable (needed for UMAX 3450)<
[plustek] >option enableTPA 0<
[plustek] Decoding option >enableTPA<
[plustek] ><
[plustek] >#<
[plustek] ># model override functionality, currently only available for<
[plustek] ># Mustek devices, using NSCs' vendor ID: 0x0400 and<
[plustek] ># also their product ID: 0x1000 (LM9831) 0x1001 (LM9832)<
[plustek] >#<
[plustek] ># mov/PID    |    0x1000   |   0x1001<
[plustek] ># ---------------------------------------<
[plustek] ># 0 (default)| BearPaw1200 | BearPaw 2400<
[plustek] ># 1          |   ignored   | BearPaw 1200<
[plustek] >#<
[plustek] >option mov 0<
[plustek] Decoding option >mov<
[plustek] ><
[plustek] >#<
[plustek] ># and of course the device-name<
[plustek] >#<
[plustek] ># device /dev/usbscanner<
[plustek] >device auto<
[plustek] Decoding device name >auto<
[plustek] ><
[plustek] >#<
[plustek] ># to define a new device, start with a new section:<
[plustek] ># [usb]<
[plustek] >#<
[plustek] attach (auto, 0x7ffeffed9fa0, (nil))
[plustek] Device configuration:
[plustek] device name  : >auto<
[plustek] USB-ID       : ><
[plustek] model ovr.   : 0
[plustek] warmup       : -1s
[plustek] lampOff      : 300
[plustek] lampOffOnEnd : yes
[plustek] cacheCalData : no
[plustek] altCalibrate : no
[plustek] skipCalibr.  : no
[plustek] skipFine     : no
[plustek] skipFineWhite: no
[plustek] skipDarkStrip: no
[plustek] incDarkTarget: yes
[plustek] invertNegs.  : no
[plustek] dis.Speedup  : no
[plustek] pos_x        : 0
[plustek] pos_y        : 0
[plustek] pos_shading_y: -1
[plustek] neg_x        : 0
[plustek] neg_y        : 0
[plustek] neg_shading_y: -1
[plustek] tpa_x        : 0
[plustek] tpa_y        : 0
[plustek] tpa_shading_y: -1
[plustek] red gain     : -1
[plustek] green gain   : -1
[plustek] blue gain    : -1
[plustek] red offset   : -1
[plustek] green offset : -1
[plustek] blue offset  : -1
[plustek] red lampoff  : -1
[plustek] green lampoff: -1
[plustek] blue lampoff : -1
[plustek] red Gamma    : 1.00
[plustek] green Gamma  : 1.00
[plustek] blue Gamma   : 1.00
[plustek] gray Gamma   : 1.00
[plustek] ---------------------
[plustek] usbDev_open(auto,) - 0x55e6fbc6e5a0
[plustek] Vendor ID=0x04A9, Product ID=0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x: found LM9832/3
[plustek]  * setting device to idle state!
[plustek] Detected vendor & product ID: 0x04A9-0x2220
[plustek] Device description for >0x04A9-0x2220< found.
[plustek] usb_initDev(43,0x04a9,-1)
[plustek] Device WAF  : 0x00004002
[plustek] Transferrate: 1000000 Bytes/s
[plustek] Device Flags: 0x00000000
[plustek] Vendor adjusted to: >Canon<
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] RESETTING REGISTERS(-1) - 0x80
[plustek] MISC I/O after RESET: 0x66, 0x16, 0x91
[plustek] Calibration file-names set to:
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-coarse.cal<
[plustek] >/home/manuel/.sane/Canon_CanoScan_LiDE25-fine.cal<
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes   = 6
[plustek] * PhyLines   = 4
[plustek] * TotalBytes = 24
[plustek] * Scansteps=72 (9*1200/150)
[plustek] usb_SetScanParameters() done.
[plustek] usbDev_getCaps()
[plustek] Scanner information:
[plustek] Vendor : Canon
[plustek] Model  : CanoScan LiDE25
[plustek] Flags  : 0x00000000
[plustek] drvclose()
[plustek] usbDev_stopScan()
[plustek] usbDev_ScanEnd(), start=0, park=0
[plustek] usbDev_close()
[plustek] attach: model = >CanoScan LiDE25<
[plustek] sane_get_devices (0x7ffeffedc120, 0)
[plustek] sane_open - libusb:001:008
[plustek] Presetting Gamma tables (len=4096)
[plustek] * Channel[0], gamma 2.000
[plustek] * Channel[1], gamma 2.000
[plustek] * Channel[2], gamma 2.000
[plustek] * Channel[3], gamma 2.000
[plustek] ----------------------------------
[plustek] sane_start
[plustek] usbDev_open(libusb:001:008,) - (nil)
[plustek] Vendor ID=0x04A9, Product ID=0x2220
[plustek] usbio_DetectLM983x
[plustek] usbio_DetectLM983x: found LM9832/3
[plustek] Detected vendor & product ID: 0x04A9-0x2220
[plustek] Device description for >0x04A9-0x2220< found.
[plustek] usb_initDev(43,0x04a9,43)
[plustek] Device WAF  : 0x00004002
[plustek] Transferrate: 1000000 Bytes/s
[plustek] Device Flags: 0x00000006
[plustek] Vendor adjusted to: >Canon<
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] RESETTING REGISTERS(43) - 0x80
[plustek] MISC I/O after RESET: 0x66, 0x16, 0x91
[plustek] usbDev_getCaps()
[plustek] scanmode = 1
[plustek] usbDev_getCropInfo()
[plustek] usb_GetImageInfo()
[plustek] PPL = 1240
[plustek] LPA = 1753
[plustek] BPL = 1240
[plustek] brightness 0, contrast 0
[plustek] usbDev_setScanEnv()
[plustek] usb_SaveImageInfo()
[plustek] * dwFlag = 0x00000400
[plustek] usb_GetImageInfo()
[plustek] * Preview Mode NOT set!
[plustek] Setting map[3] at 0x55e6fbcf7254
[plustek] usbDev_startScan()
[plustek] LAMP-STATUS: 0x00000000 (off)
[plustek] Switching Lamp on
[plustek] Warmup-Timer started
[plustek] LAMP-STATUS: 0x00000001 (on)
[plustek] Lamp-Timer stopped
[plustek] dwflag = 0x40000400 dwBytesLine = 1240
[plustek] Lines          = 1753
[plustek] Bytes per Line = 1240
[plustek] Bitdepth       = 8
[plustek] TIME START
[plustek] local_sane_start done
[plustek] reader_process started (as thread)
[plustek] reader_process:starting to READ data (2173720 bytes)
[plustek] buf = 0x7f1864447010
[plustek] usbDev_PrepareScan()
[plustek] sane_start done
[plustek] cano_DoCalibration()
[plustek] #########################
[plustek] usb_SpeedTest(43,1000000)
[plustek] GETMCLK[10/1], using entry 8: 12.000, 1200
[plustek] SETMCLK[10/1]: 12.000
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes   = 30606
[plustek] * PhyLines   = 1
[plustek] * TotalBytes = 30606
[plustek] usb_SetScanParameters() done.
[plustek] usb_ScanBegin()
[plustek] usb_DownloadShadingData(1)
[plustek] usb_ScanBegin() done.
[plustek] usb_IsDataAvailableInDRAM()
[plustek] Data is available
[plustek] usbDev_ScanEnd(), start=1, park=0
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()
[plustek] * PhyBytes   = 30606
[plustek] * PhyLines   = 1
[plustek] * TotalBytes = 30606
[plustek] usb_SetScanParameters() done.
[plustek] usb_ScanBegin()
[plustek] usb_DownloadShadingData(1)
[plustek] usb_ScanBegin() done.
[plustek] usb_IsDataAvailableInDRAM()
[plustek] Data is available
[plustek] usbDev_ScanEnd(), start=1, park=0
[plustek] usb_SetScanParameters()
[plustek] usb_GetMCLKDivider()
[plustek] usb_GetMCLKDiv()...

Hope that helps a little bit Manuel

这篇关于Webusb扫描文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆