int ecm_fd_function_enable (struct usbd_function_instance *function_instance) { struct usb_network_private *npd; struct usbd_class_ethernet_networking_descriptor *ethernet = &ecm_class_2; char address_str[14]; /* do normal network function enable first - this creates network private data */ RETURN_EINVAL_IF(net_fd_function_enable(function_instance, network_ecm, net_fd_recv_urb_ecm, net_fd_start_xmit_ecm, net_fd_start_recv_ecm, 0 )); npd = function_instance->privdata; /* if successful then lets allocate iMACAddress string */ TRACE_MSG6(NTT, "local: %02x:%02x:%02x:%02x:%02x:%02x", npd->local_dev_addr[0], npd->local_dev_addr[1], npd->local_dev_addr[2], npd->local_dev_addr[3], npd->local_dev_addr[4], npd->local_dev_addr[5]); TRACE_MSG6(NTT, "remote: %02x:%02x:%02x:%02x:%02x:%02x", npd->remote_dev_addr[0], npd->remote_dev_addr[1], npd->remote_dev_addr[2], npd->remote_dev_addr[3], npd->remote_dev_addr[4], npd->remote_dev_addr[5]); snprintf(address_str, 13, "%02x%02x%02x%02x%02x%02x", npd->remote_dev_addr[0], npd->remote_dev_addr[1], npd->remote_dev_addr[2], npd->remote_dev_addr[3], npd->remote_dev_addr[4], npd->remote_dev_addr[5]); ethernet->iMACAddress = usbd_alloc_string(function_instance, address_str); return 0; }
int blan_fd_function_enable (struct usbd_function_instance *function_instance) { struct usbd_class_network_channel_descriptor *channel = &blan_class_5 ; struct usb_network_private *npd = NULL; u32 recv_urb_flags; #if 0 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17) struct usbd_class_ethernet_networking_descriptor *ethernet = &blan_class_4; char address_str[14]; snprintf(address_str, 13, "%02x%02x%02x%02x%02x%02x", local_dev_addr[0], local_dev_addr[1], local_dev_addr[2], local_dev_addr[3], local_dev_addr[4], local_dev_addr[5]); #else char address_str[20]; sprintf(address_str, "%02x%02x%02x%02x%02x%02x", local_dev_addr[0], local_dev_addr[1], local_dev_addr[2], local_dev_addr[3], local_dev_addr[4], local_dev_addr[5]); #endif ethernet->iMACAddress = usbd_alloc_string(address_str); #endif struct usbd_class_ethernet_networking_descriptor *ethernet = &blan_class_4; char address_str[20]; sprintf(address_str, "%02x%02x%02x%02x%02x%02x", 0, 0, 0, 0, 0, 0); ethernet->iMACAddress = usbd_alloc_string(function_instance, address_str); //channel->iName = usbd_alloc_string(function_instance, system_utsname.nodename); //TRACE_MSG3(NTT, "name: %s strings index imac: %d name: %d", // system_utsname.nodename, ethernet->iMACAddress, channel->iName); #if defined(CONFIG_OTG_NETWORK_BLAN_CRC) || defined(CONFIG_OTG_NETWORK_SAFE_CRC) recv_urb_flags = 0; #else /* defined(CONFIG_OTG_NETWORK_BLAN_CRC) || defined(CONFIG_OTG_NETWORK_SAFE_CRC) */ recv_urb_flags = USBD_URB_FAST_RETURN | USBD_URB_FAST_FINISH; #endif /* defined(CONFIG_OTG_NETWORK_BLAN_CRC) || defined(CONFIG_OTG_NETWORK_SAFE_CRC) */ THROW_IF(net_fd_function_enable(function_instance, network_blan, net_fd_recv_urb_mdlm, net_fd_start_xmit_mdlm, blan_start_recv, recv_urb_flags ), error); THROW_UNLESS((npd = function_instance->privdata), error); #if !defined(CONFIG_OTG_NETWORK_BLAN_CRC) && !defined(CONFIG_OTG_NETWORK_SAFE_CRC) THROW_UNLESS((npd->blan_recv_task = otg_task_init2("blanrcv", blan_start_recv_task, function_instance, NTT)), error); //npd->blan_recv_task->taskdebug = TRUE; otg_task_start(npd->blan_recv_task); #endif /* !defined(CONFIG_OTG_NETWORK_BLAN_CRC) && !defined(CONFIG_OTG_NETWORK_SAFE_CRC) */ return 0; CATCH(error) { return -EINVAL; } }
int safe_fd_function_enable (struct usbd_function_instance *function_instance) { struct usbd_class_ethernet_networking_descriptor *ethernet = &safe_class_4; //struct usbd_class_network_channel_descriptor *channel = &safe_class_5 ; #if 0 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17) char address_str[14]; snprintf(address_str, 13, "%02x%02x%02x%02x%02x%02x", local_dev_addr[0], local_dev_addr[1], local_dev_addr[2], local_dev_addr[3], local_dev_addr[4], local_dev_addr[5]); #else char address_str[20]; sprintf(address_str, "%02x%02x%02x%02x%02x%02x", local_dev_addr[0], local_dev_addr[1], local_dev_addr[2], local_dev_addr[3], local_dev_addr[4], local_dev_addr[5]); #endif #endif //ethernet->iMACAddress = usbd_alloc_string(address_str); //channel->iName = usbd_alloc_string(system_utsname.nodename); return net_fd_function_enable(function_instance, network_safe); }