From owner-freebsd-usb@FreeBSD.ORG Tue Oct 8 23:21:41 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7CA3A6DE for ; Tue, 8 Oct 2013 23:21:41 +0000 (UTC) (envelope-from aseem.jolly@gmail.com) Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E43B2A36 for ; Tue, 8 Oct 2013 23:21:41 +0000 (UTC) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VTgay-00051d-11 for freebsd-usb@freebsd.org; Tue, 08 Oct 2013 16:21:40 -0700 Date: Tue, 8 Oct 2013 16:21:40 -0700 (PDT) From: "aseem.jolly" To: freebsd-usb@freebsd.org Message-ID: <1381274499940-5850403.post@n5.nabble.com> Subject: USB device configuration MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 23:21:41 -0000 In usb_device_alloc function, after putting the device into powered state. We try to select configuration 1(default configuration of most of the USB devices) by calling *usbd_set_config_index* In *usb_set_config_index*, we check for power requirements, then make a request to the device to select the configuration and if we see an error in performing this request, we goto done where we unconfigure the usb. Don't you think that we need to change the state back 'powered' again during unconfiguration or we should change the state to configured only when *usbd_req_set_config* return 0(success). udev->power = power; udev->curr_config_no = cdp->bConfigurationValue; udev->curr_config_index = index; *usb_set_device_state(udev, USB_STATE_CONFIGURED);* /* Set the actual configuration value. */ err = *usbd_req_set_config(udev, NULL, cdp->bConfigurationValue);* if (err) { goto done; } Basically, I mean somthing like udev->power = power; udev->curr_config_no = cdp->bConfigurationValue; udev->curr_config_index = index; /* Set the actual configuration value. */ err = *usbd_req_set_config(udev, NULL, cdp->bConfigurationValue);* if (err) { goto done; * } else { usb_set_device_state(udev, USB_STATE_CONFIGURED); }* -- View this message in context: http://freebsd.1045724.n5.nabble.com/USB-device-configuration-tp5850403.html Sent from the freebsd-usb mailing list archive at Nabble.com.