From owner-freebsd-usb@freebsd.org Mon Mar 2 03:54:47 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D54D258131 for ; Mon, 2 Mar 2020 03:54:47 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48W5r63VV2z4HkK for ; Mon, 2 Mar 2020 03:54:46 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9605522278; Sun, 1 Mar 2020 22:54:45 -0500 (EST) Received: from imap35 ([10.202.2.85]) by compute1.internal (MEProxy); Sun, 01 Mar 2020 22:54:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=farhan.codes; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm2; bh=ydJye++wd9pHjaDY1R8nZRcHC1V5HE1 PVrFUzdcxFOA=; b=yXFpK7ubGnY+KkFRK9iFr+wKE239kYm7bmqC2/193u/yKa3 9zj3HvNSxVQC1hgPMs4Z3LBtVuUH7pzooQYc3LlZhIdh8l3ajdeIlR9cTRtxfUe8 8SXqIwP9Ye9zxCrnCTRTg71ksC2NO8xTtsCM69RtR0XE/Hcf34kZu7NhU5LqIG2Y 7mH3JsCh+yZyO1Pbs/6Sf1DgKIsDry7hyXRZTY/fHOGqVoeXzWQ1OKdwk5f1gfny 88j0Cl/UR4V25n7HBcF/JPm1SA8Fmso3thl9Pv5ZuCjmzEi5kbSHdE4W5UaAfr0Y ClOSb/+isSyICLPpLYMDnoT0OPMSUFe4UKmGEEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ydJye+ +wd9pHjaDY1R8nZRcHC1V5HE1PVrFUzdcxFOA=; b=wmE9RVKD1f8IrwBvQY7AGq Dihq/iFALLRPjFuvl9JbRZBE6lsm0YoCxlpsDA0gqZXMVi0zd+cVwbCDAiUc+jjB oGTRgaRxRgWUAtMDC2XbNqQXTPvJlgzS0UmzfPLPpfwLmxTCr1DTycfiM9TQsMm7 4aJk9/RqJ2br8rn7T6ij0uln5MEM02WouPUXlJcSOltB1h3XJ+YyPX4uKIwwTSkN QlO3YenvNjv+QSzq7sx81T/e3/XXKQ3cciPtDbVPAhXe+GQsaXISu2u5cjZ2vB+F gPM7sy8VkKYvfXytmPZIRUVoUrLkjm7Q89U6JovCYW1v2mBEpCrQobLgVx189ccQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddtfedgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerredtnecuhfhrohhmpedfhfgrrhhhrghnucfmhhgrnhdfuceofhgrrhhhrghnsehf rghrhhgrnhdrtghouggvsheqnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepfhgrrhhhrghnsehfrghrhhgrnhdrtghouggvsh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2DF5314C017C; Sun, 1 Mar 2020 22:54:45 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-967-g014f925-fmstable-20200226v1 Mime-Version: 1.0 Message-Id: <0da4a58c-fcda-4755-b129-5c2da925da9e@www.fastmail.com> In-Reply-To: References: <52e73cc5-5881-40bd-99bf-5b69f5cbcc4f@www.fastmail.com> Date: Sun, 01 Mar 2020 22:54:24 -0500 From: "Farhan Khan" To: "Hans Petter Selasky" , freebsd-usb@freebsd.org Subject: Re: Detecting if USB device pulled from machine X-Rspamd-Queue-Id: 48W5r63VV2z4HkK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm2 header.b=yXFpK7ub; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=wmE9RVKD; dmarc=none; spf=pass (mx1.freebsd.org: domain of farhan@farhan.codes designates 66.111.4.25 as permitted sender) smtp.mailfrom=farhan@farhan.codes X-Spamd-Result: default: False [-5.08 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=fm2,messagingengine.com:s=fm2]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[25.4.111.66.rep.mailspike.net : 127.0.0.18]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.25]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[farhan.codes]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[farhan.codes:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; IP_SCORE(-3.49)[ip: (-9.81), ipnet: 66.111.4.0/24(-4.89), asn: 11403(-2.69), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[25.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2020 03:54:47 -0000 I think I figured it out. There is no specific mechanism, its just that the detach() function updates that value. This was a misunderstanding on my part. Thank you! On Sun, Mar 1, 2020, at 7:49 AM, Hans Petter Selasky wrote: > On 2020-03-01 08:50, Farhan Khan wrote: > > Hi all, > > > > Quick question: I am reviewing some USB code between FreeBSD and OpenBSD. In OpenBSD, there is a function called usbd_is_dying (sys/dev/usb/usbdi.c) which appears to check if a device was removed from the system. Is there an equivalent in FreeBSD? > > > > Thanks! > > Hi, > > Check how "libusb20_dev_check_connected()" works in libusb. > > --HPS > -- Farhan Khan PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE