0

I need to be able to interface with a USB scanner (specifically a Epson Perfection V550). I have tried ImageScanner, and it does not seem to find my device (I have also tried to install twain, but it is having issues saying that

Could not find any downloads that satisfy the requirement twain.)

So instead I turned to PyUSB, which can see that the device is there. The problem I now have is that I am not sure what I need to send the device for it to scan and send me back a picture.

Here is code I have run:

import usb.core
import usb.util
import sys

venderID = 0x04B8
productID = 0x013B

dev = usb.core.find(idVendor=venderID, idProduct=productID)
for cfg in dev:
    print cfg

and the output to that is:

CONFIGURATION 1: 2 mA ====================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x20 (32 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0
   bmAttributes         :   0xc0 Self Powered
   bMaxPower            :    0x1 (2 mA)
    INTERFACE 0: Vendor Specific ===========================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x2
     bInterfaceClass    :   0xff Vendor Specific
     bInterfaceSubClass :   0xff
     bInterfaceProtocol :   0xff
     iInterface         :    0x0
      ENDPOINT 0x81: Bulk IN ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x81 IN
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x200 (512 bytes)
       bInterval        :   0xff
      ENDPOINT 0x2: Bulk OUT ===============================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :    0x2 OUT
       bmAttributes     :    0x2 Bulk
       wMaxPacketSize   :  0x200 (512 bytes)
       bInterval        :   0xff
Wesley Bowman
  • 1,366
  • 16
  • 35
  • Are you expressly trying to do this in code or would you be satisfied with an application that worked? I have been happy with vuescan for my Fujitsu ScanSnap S1500. Works in linux and Windows for a USB scanner, but perhaps not yours. – hughdbrown Jul 07 '14 at 12:57
  • Expressly trying to do this with Python. I can access with scanner with its default software that came with it, but that is not the goal of this project. – Wesley Bowman Jul 07 '14 at 13:00
  • 1
    PyUSB only allows you access to the raw USB descriptors/endpoints. To get your scanner to run, you would have to implement your own driver in Python, which is *a lot* of work. You'd be better suited trying to get TWAIN to work. – jbaiter Jul 08 '14 at 12:58
  • Check out this project and see if it helps you get TWAIN working. https://github.com/pelletier/django-dynamictwain – Rachel Jul 09 '14 at 06:00

1 Answers1

0

If you can make your scanner work in Windows, what you can do is set up a Windows virtual machine on a linux host. I recommend gnome-boxes / KVM. You'll need a host machine with CPU virtualisation extensions (most modern CPUs have this).

Then install Wireshark on the host machine. Usnig wireshark, you can monitor the USB communications between the Windows scanner driver and the device. Based on this, you can hopefully reverse engineer the USB protocol. Once you understand the protocol, implementing it using PyUSB is relatively easy.

  • Alright. I don't need the program to work in Linux, only in Windows, and the scanner will work on Windows. I already have Wireshark so I will look into reverse engineering it that way. Thanks. Will inform of my progress. – Wesley Bowman Jul 09 '14 at 11:49