none
Mimicing a USB Printer RRS feed

  • Question

  • I am developing a module based on a BananaPi which sits inline between the PC and a USB printer to capture and store the data being printed.  I am testing it using Windows 10 and Windows 7 running in a virtual PC.

    I am using the OTG port on the BananaPi to communicate with the PC and successfully capture the idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNum and iPNPstring of the connected USB printer, and use this to configure the gadget printer on the OTG port.

    Windows then sees the BananaPi as the correct printer and I can print using this setup (and capture the data).  However, there are minor differences somewhere:

    a) One of my printers (a HP multi-function printer), is normally identified by WIndows as HP 3060A (or similar) - however, when connected via the BananaPi, Windows creates a second printer, say HP 3060A (Copy 1)

    b) The other printer is an SNBC Receipt Printer - BTP-R580II.  When connected directly to Windows, it is connected to port USB001 (which shows the printer as BTP-R580II).  However, when I connect it via the BananaPi, Windows cannot print to it, until, I switch it to port USB002 (neither port USB001 nor USB002 show any printer name).

    So the question is, what important parameter am I missing that is presumably being passed by the original printers when connected directly, and not being passed by the BananaPi's OTG port?

    I can't find anywhere online which lists any other information required by Windows other than the 7 descriptors which I am already passing (see above)

    Get-Printer shows the exact same details for when the printer is connected directly to the computer, and when the printer is connected via the BananaPi.

    However, the registry shows some differences:

    USBPRINT\BEIYANGBTP-R580(U)1\6&1984e8c7&0&USB002
    USB\VID_154F&PID_0517\None

    and
    USBPRINT\BEIYANGBTP-R580(U)1\6&2b81704a&0&USB001
    USB\VID_154F&PID_0517\5&bcfc0a&0&1

    I believe that the section \5&bcfc0a&0&1 for the USB printer when connected directly is actually the parentId prefix for the device.  I wonder why this is not present when I connect via the BananaPi (or is this a serial number?)

    There are also some interesting entries in :
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB

    USB\VID_154F&PID_0517&REV_01?0
    USB\VID_154F&PID_0517

    THis matches the parameters from Linux (apart from the revision number) - certainly Linux is reporting the second set - the output of the Linux command lsusb -v gives the following descriptors from the USB printer:

    Bus 004 Device 002: ID 154f:0517 SNBC CO., Ltd 
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               1.10
      bDeviceClass            0 (Defined at Interface level)
      bDeviceSubClass         0 
      bDeviceProtocol         0 
      bMaxPacketSize0        64
      idVendor           0x154f SNBC CO., Ltd
      idProduct          0x0517 
      bcdDevice            1.f0
      iManufacturer           1 BEIYANG
      iProduct                2 BTP-R580(U)
      iSerial                 0 
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength           39
        bNumInterfaces          1
        bConfigurationValue     1
        iConfiguration          0 
        bmAttributes         0xc0
          Self Powered
        MaxPower              100mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           3
          bInterfaceClass         7 Printer
          bInterfaceSubClass      1 Printer
          bInterfaceProtocol      2 Bidirectional
          iInterface              0 
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x02  EP 2 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x85  EP 5 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
    Device Status:     0x0001
      Self Powered


    Rich Mellor www.rwapservices.co.uk

    Tuesday, August 30, 2016 1:25 PM

All replies

  • I am still having issues here - it does not help that the original printer returns a null string for both the iProduct and the iSerialNumber - could that be the reason?

    Rich Mellor www.rwapservices.co.uk

    Thursday, September 15, 2016 5:55 AM