Example #1
0
USB_STATUS usb_printer_get_device_ID
   (
      /* [IN] class-interface data pointer + key */
      CLASS_CALL_STRUCT_PTR      cc_ptr,
      
      /* [IN] callback for completion/status */
      tr_callback                callback,
      
      /* [IN] user parameter returned by callback */
      pointer                    call_parm,
      
      /* [IN] buffer length */
      uint_32                    buf_size,
      
      /* [OUT] device ID buffer */
      uchar_ptr                  buffer
   )
{ /* Body */

   TR_INIT_PARAM_STRUCT          tr;
   USB_STATUS                    error;
   USB_SETUP                     dev_req;

   #ifdef _HOST_DEBUG_
      DEBUG_LOG_TRACE("usb_printer_get_device_ID");
   #endif

   if (USB_OK != (error = usb_printer_class_verify 
      (cc_ptr, &tr, callback, call_parm)))
   {
      #ifdef _HOST_DEBUG_
         DEBUG_LOG_TRACE("usb_printer_get_device_ID, error validating class");
      #endif
      return error;
   } /* Endif */

   tr.RX_BUFFER = (pointer)buffer;
   tr.RX_LENGTH = buf_size;
   tr.DEV_REQ_PTR = (uchar_ptr)(&dev_req);
   dev_req.BMREQUESTTYPE = REQ_TYPE_CLASS | REQ_TYPE_INTERFACE |
      REQ_TYPE_IN;
   dev_req.BREQUEST = USB_PRINTER_GET_DEVICE_ID;

   #ifdef _HOST_DEBUG_
      DEBUG_LOG_TRACE("usb_printer_get_device_ID, SUCCESSFUL");
   #endif

   return usb_printer_class_send(cc_ptr, &tr);

} /* Endbody */
Example #2
0
USB_STATUS usb_printer_soft_reset
   (
      /* [IN] class-interface data pointer + key */
      CLASS_CALL_STRUCT_PTR      cc_ptr,
      
      /* [IN] callback for completion/status */
      tr_callback                callback,
      
      /* [IN] user parameter returned by callback */
      pointer                    call_parm     
   )
{ /* Body */

   TR_INIT_PARAM_STRUCT          tr;
   USB_STATUS                    error;
   USB_SETUP                     dev_req;

   #ifdef _HOST_DEBUG_
      DEBUG_LOG_TRACE("usb_printer_soft_reset");
   #endif

   if (USB_OK != (error = usb_printer_class_verify 
      (cc_ptr, &tr, callback, call_parm)))
   {
      #ifdef _HOST_DEBUG_
         DEBUG_LOG_TRACE("usb_printer_soft_reset, error class verify failed");
      #endif
      return error;
   } /* Endif */

   tr.G.RX_BUFFER = NULL;
   tr.G.RX_LENGTH = 0;
   tr.DEV_REQ_PTR = (uchar_ptr)(&dev_req);
   dev_req.BMREQUESTTYPE = REQ_TYPE_CLASS | REQ_TYPE_INTERFACE;
   dev_req.BREQUEST = USB_PRINTER_SOFT_RESET;

   #ifdef _HOST_DEBUG_
      DEBUG_LOG_TRACE("usb_printer_soft_reset, SUCCESSFUL");
   #endif
   return usb_printer_class_send (cc_ptr, &tr);   

} /* Endbody */