usb bulk transfer

Hello Sir,

I am making a receipt printer for point of sale application using LPC2368 controller. I want to use USB interface for receiving data from computer to printer.I am using bulk transfer for data receiving and sending data. I started using Keil USB HID source code example and converted this source code for bulk transfer using following changes in configuration descriptor and few other changes

const UWORD8 USB_ConfigDescriptor[] = {
/* Configuration 1 */
  USB_CONFIGUARTION_DESC_SIZE,       /* bLength */
  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
  WBVAL(                             /* wTotalLength */
    1*USB_CONFIGUARTION_DESC_SIZE +
    1*USB_INTERFACE_DESC_SIZE     +
    2*USB_ENDPOINT_DESC_SIZE
  ),
  0x01,                              /* bNumInterfaces */
  0x01,                              /* bConfigurationValue */
  0x00,                              /* iConfiguration */
  USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes */
/*USB_CONFIG_REMOTE_WAKEUP*/,
  USB_CONFIG_POWER_MA(100),          /* bMaxPower */
/* Interface 0, Alternate Setting 0, MSC Class */
  USB_INTERFACE_DESC_SIZE,           /* bLength */
  USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
  0x00,                              /* bInterfaceNumber */
  0x00,                              /* bAlternateSetting */
  0x02,                              /* bNumEndpoints */
  USB_DEVICE_CLASS_PRINTER,          /* bInterfaceClass */
  0x01,                              /* bInterfaceSubClass */
  0x02,                             /* bInterfaceProtocol */
  0x62,                              /* iInterface */
/* Bulk In Endpoint */
  USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_IN(2),                /* bEndpointAddress */
  USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
  WBVAL(0x0040),                     /* wMaxPacketSize */
  0,                                 /* bInterval */
/* Bulk Out Endpoint */
  USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
  USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
  WBVAL(0x0040),                     /* wMaxPacketSize */
  0,                                 /* bInterval */
/* Terminator */
  0                                  /* bLength */
};

Computer recognize my board usb device as a USB printing support successfully. I just want to know that is there is any class descriptor like HID class descriptor for printer or not?

And also I want to know that Is there is any host application to check bulk out transfer .

Thanks & Regards
Rohit

Parents
  • Your printer descriptors seem fine.

    > I just want to know that is there is any class descriptor like HID class descriptor for printer or not?

    Printer class doesn't have any extra descriptor, unlike HID report descriptor.
    Instead, GET_DEVICE_ID request returns Printer "Device ID" string, which describes printer's property.

    Windows has a default INF file for "Generic" printers. To install your printer silently (ie. without any INF file), apply this Device ID for "Generic Text Only".

    typedef struct __attribute__ ((packed))
    {
        BYTE size_h, size_l;
        BYTE str[];
    } T_prn_Device_ID;
    
    static const T_prn_Device_ID prn_Device_ID =
    {
       0x00, 12 + 24 + 11 + 12 + 30,          // size of string, two-bytes, MSB first
       {                                      // these strings are concatenated by compiler
           "MFG:Generic;"                     //   manufacturer (case sensitive)
           "MDL:Generic_/_Text_Only;"         //   model (case sensitive)
           "CMD:1284.4;"                      //   PDL command set
           "CLS:PRINTER;"                     //   class
           "DES:Generic text only printer;"   //   description
       }
    };
    

    I posted this tip of USB printer on these forum threads,

    USB Printer Class(Client, not Host) - Microchip USB forum
    " href= "e2e.ti.com/.../217001.aspx"> e2e.ti.com/.../217001.aspx

    [USB printer spec]
    "Printer Device Class Document 1.1"
    www.usb.org/.../usbprint11.pdf



    > And also I want to know that Is there is any host application to check bulk out transfer .

    Printer port is accessed over WinAPI.
    - How to send raw data to a printer by using Visual C# .NET
    support.microsoft.com/.../en-us
    - HOWTO: Send Raw Data to a Printer by Using the Win32 API
    support.microsoft.com/.../en-us
    - How to send raw data to a printer by using Visual Basic .NET
    support.microsoft.com/.../en-us

    Tsuneo

Reply
  • Your printer descriptors seem fine.

    > I just want to know that is there is any class descriptor like HID class descriptor for printer or not?

    Printer class doesn't have any extra descriptor, unlike HID report descriptor.
    Instead, GET_DEVICE_ID request returns Printer "Device ID" string, which describes printer's property.

    Windows has a default INF file for "Generic" printers. To install your printer silently (ie. without any INF file), apply this Device ID for "Generic Text Only".

    typedef struct __attribute__ ((packed))
    {
        BYTE size_h, size_l;
        BYTE str[];
    } T_prn_Device_ID;
    
    static const T_prn_Device_ID prn_Device_ID =
    {
       0x00, 12 + 24 + 11 + 12 + 30,          // size of string, two-bytes, MSB first
       {                                      // these strings are concatenated by compiler
           "MFG:Generic;"                     //   manufacturer (case sensitive)
           "MDL:Generic_/_Text_Only;"         //   model (case sensitive)
           "CMD:1284.4;"                      //   PDL command set
           "CLS:PRINTER;"                     //   class
           "DES:Generic text only printer;"   //   description
       }
    };
    

    I posted this tip of USB printer on these forum threads,

    USB Printer Class(Client, not Host) - Microchip USB forum
    " href= "e2e.ti.com/.../217001.aspx"> e2e.ti.com/.../217001.aspx

    [USB printer spec]
    "Printer Device Class Document 1.1"
    www.usb.org/.../usbprint11.pdf



    > And also I want to know that Is there is any host application to check bulk out transfer .

    Printer port is accessed over WinAPI.
    - How to send raw data to a printer by using Visual C# .NET
    support.microsoft.com/.../en-us
    - HOWTO: Send Raw Data to a Printer by Using the Win32 API
    support.microsoft.com/.../en-us
    - How to send raw data to a printer by using Visual Basic .NET
    support.microsoft.com/.../en-us

    Tsuneo

Children
More questions in this forum