From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 14 14:30:00 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E45516A421 for ; Tue, 14 Aug 2007 14:30:00 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from ns.trinitel.com (186.161.36.72.static.reverse.ltdomains.com [72.36.161.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5786513C461 for ; Tue, 14 Aug 2007 14:30:00 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from proton.local (209-163-168-124.static.twtelecom.net [209.163.168.124]) (authenticated bits=0) by ns.trinitel.com (8.14.1/8.14.1) with ESMTP id l7EETtaL074528; Tue, 14 Aug 2007 09:29:55 -0500 (CDT) (envelope-from anderson@freebsd.org) Message-ID: <46C1BC60.5000801@freebsd.org> Date: Tue, 14 Aug 2007 09:29:52 -0500 From: Eric Anderson User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Sven Hazejager References: <07081411265549.-1077952816@somehost.domainz.com> <20070814030833.49a7a030@soralx> <20070814041736.4c16f41e@soralx> <07081416114656.-1077948560@somehost.domainz.com> In-Reply-To: <07081416114656.-1077948560@somehost.domainz.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on ns.trinitel.com Cc: freebsd-hackers@freebsd.org Subject: Re: How to stop attached USB device / send IRP_MN_REMOVE_DEVICE? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2007 14:30:00 -0000 Sven Hazejager wrote: >>>> So, the question really is: how to send a IRP_MN_REMOVE_DEVICE >>>> command? >>> >>> `camcontrol da? stop` seemed to do the trick before (5.2.1-R, AFAIR), >>> but now I'm not sure (looks like it doesn't) >> >> sorry, I meant to say that `camcontrol da? stop` does not power down >> the device anymore; nonetheless, it is probably safe to disconnect it > > No, camcontrol does not support this over USB. Windows XP demonstrates > it is technically possible, and I do not believe it is fully safe to > disconnect the drive (even when unmounted), as the drive then is not > able to park its heads, which it DOES do under XP. > > So, we come back to the original question: how to send an > IRP_MN_REMOVE_DEVICE event? Maybe this helps? man camcontrol ? : cmd Allows the user to send an arbitrary SCSI CDB to any device. The cmd function requires the -c argument to specify the CDB. Other arguments are optional, depending on the command type. The command and data specification syntax is documented in cam_cdbparse(3). NOTE: If the CDB specified causes data to be transfered to or from the SCSI device in question, you MUST specify either -i or -o. -c cmd [args] This specifies the SCSI CDB. CDBs may be 6, 10, 12 or 16 bytes. -i len fmt This specifies the amount of data to read, and how it should be displayed. If the format is `-', len bytes of data will be read from the device and written to stan- dard output. -o len fmt [args] This specifies the amount of data to be written to a device, and the data that is to be written. If the format is `-', len bytes of data will be read from standard input and written to the device.