USB CDC disable callback

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This callback is not executing when the USB cable is disconnected, instead fires on reconnection.

Same if I disable the port in Device Manager.

#define UDI_CDC_DISABLE_EXT(port) my_callback_cdc_disable()

From the ASF website:

"When the USB device is unplugged or is reset by the USB host, the USB interface is disabled and the UDI_CDC_DISABLE_EXT() callback function is called. Thus, the data transfer must be stopped on CDC interface."

 

Is there something I am doing wrong?

 

I am using EVK1100 hardware running AT32UC3A0512

PC is running windows 8

 

I have tried upgrading to ASF 3.21.0 , still not working

Last Edited: Tue. May 3, 2016 - 08:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am seeing the same issue too. 

What's happening is on a disconnect, not thing would fire, but upon a reconnect, it fires the UDI_CDC_DISABLE_EXT(), then UDI_CDC_ENABLE_EXT(port).

 

Have you (or anyone) found a solution?

 

I am using ASF 6.2 with SAM4S Xplained pro.

 

Best,

hvo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still having the same issue with ASF 3.33.0 on an xmega128A3U system. The callback is only executed from one place, at the "bottom" of the udc_iface_disable() function (see below) through

udi_api->disable();

Maybe udc_iface_disable() already returns "false" at the point where the cable was disconnected due to some semantic issue and is thus exiting before the callback is fired. I currently don't have the time to dig into it any further.

 

static bool udc_iface_disable(uint8_t iface_num)
{
  udi_api_t UDC_DESC_STORAGE *udi_api;

  // Select first alternate setting of the interface
  // to update udc_ptr_iface before call iface->getsetting()
  if (!udc_update_iface_desc(iface_num, 0)) {
    return false;
  }

  // Select the interface with the current alternate setting
  udi_api = udc_ptr_conf->udi_apis[iface_num];

#if (0!=USB_DEVICE_MAX_EP)
  if (!udc_update_iface_desc(iface_num, udi_api->getsetting())) {
    return false;
  }

  // Start at the beginning of interface descriptor
  {
    usb_ep_desc_t UDC_DESC_STORAGE *ep_desc;
    ep_desc = (UDC_DESC_STORAGE usb_ep_desc_t *) udc_ptr_iface;
    while (1) {
      // Search Endpoint descriptor included in global interface descriptor
      ep_desc = (UDC_DESC_STORAGE usb_ep_desc_t *)
          udc_next_desc_in_iface((UDC_DESC_STORAGE
          usb_conf_desc_t *)
          ep_desc, USB_DT_ENDPOINT);
      if (NULL == ep_desc) {
        break;
      }
      // Free the endpoint used by the interface
      udd_ep_free(ep_desc->bEndpointAddress);
    }
  }
#endif

  // Disable interface
  udi_api->disable();
  return true;
}

 

Last Edited: Mon. Jan 16, 2017 - 11:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Guys, resurrecting an old thread here I know, but did anyone find a solution to this?

 

It seems that udc_iface_disable() is not being called at all on usb host disconnect. 

 

Thanks