From owner-freebsd-hackers@freebsd.org Sun May 16 16:43:18 2021 Return-Path: Delivered-To: freebsd-hackers@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 B14ED6287B8 for ; Sun, 16 May 2021 16:43:18 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4Fjp3p4Fjnz4llN for ; Sun, 16 May 2021 16:43:18 +0000 (UTC) (envelope-from ian@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 91DD462855A; Sun, 16 May 2021 16:43:18 +0000 (UTC) Delivered-To: hackers@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 919F36287B6 for ; Sun, 16 May 2021 16:43:18 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5c.ore.mailhop.org (outbound5c.ore.mailhop.org [54.244.192.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fjp3p2SCNz4lyc for ; Sun, 16 May 2021 16:43:18 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1621183397; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=ctHdaX/L9JcZUxsNxD7xeaBDMJClAT1cndXYembmeD1ZYIAY72byr5ISB42NdmlhVL1pJSo5STfmU gQzRVCeigWpXvTpU4y1X4+fQd7ItNvOm6FuxLF8234SBVWJCxaLn7i8uSdR2j+rZMWKE9Ih3JC/daS poueKN7JywxnwV9sIdVNlZTVjF1xgGpct/hMSI0ufPvSq32CsjclsaDVBid2Ocu5CCxTqy2g2fYTD1 28H/Xk410g0lmhk9UrUbF7ee9aPQdxe+AUSsjBaPqsp5ubDAEPr+sdw4fF45O8afRyY8mlk+LUWWQc 5T8gS5JrP6ACMFkzOK9v23F1IJ7qlrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=KipnR5+uWqdG8G7fxxoEhMq/ysDpZRebE6zxp9Kd7bw=; b=ZcE83wx6VjmXzMShmvTVmcet6+8ATCZ/6QjozGHZPLcd24MoX+Kou+f6BCbnHWTz0+p89I9jRuM/J sIWQdN+kIBuqbleR6W8uuQ2LcVor8VUfZoh0DxhEeMkJ1UfTNBJQJqcysXqvgJNzI7k+7MDz8dSQlm gL/AOMHYh8q0EsTuFcian3q+yaq29BnFuIi63uciPgsUBiswYisyssdHyeEaXOwg4kC/3dsIcbrlu4 hIRaNpR9OgZO715hIMA1N+nLFSXVBC8P9na7JEs1Al0PdIkCtLal3+rWErKHCoLH33FX9ymbj5899h /vSKzCThLIyEHDFJiAGR9+m9Rrtmo3A== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=KipnR5+uWqdG8G7fxxoEhMq/ysDpZRebE6zxp9Kd7bw=; b=AmiJOVEPxVFKKEfZh62ILphDDRHt4NVfQjTL63qsydN986YbRgxT51UgM4DnK5Ls0XhUJfvpGgNid SaRqggF3q7k+2mYbGiX9nlrlY3hTgfZ2IABxjHid3KO/dGaEVGZwl+7l/4ruuWrTrPaXkrSGQLn3/e VdJ34USJ0+uDsYZrIUw+GVQVLymy8K8DpWn+0c8qZO3RGfQofKcGF6e6x3HFHWFVK4Wqqu+LJNuLGP I6WRXLfuFQCtXX1FnjJez7yGTzk93DwvdFKtOxp7SxHFNDDbXj3QM9UqGVfMJahjggGdDAXYn7RHup RrUI0j1kUGpHvuHiIg5nx0nuJzDHxTw== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: cec407d5-b665-11eb-841b-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id cec407d5-b665-11eb-841b-bf9d68d023b6; Sun, 16 May 2021 16:43:16 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 14GGhDiE064418; Sun, 16 May 2021 10:43:14 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <058b3056a0adf05ac6e124a989b9b8250ff36ce3.camel@freebsd.org> Subject: Re: patch: make i2c(8) usable for scripting From: Ian Lepore To: Poul-Henning Kamp Cc: hackers@freebsd.org Date: Sun, 16 May 2021 10:43:13 -0600 In-Reply-To: <13972.1621147890@critter.freebsd.dk> References: <12056.1621109641@critter.freebsd.dk> <8d232feb354bf404426c51efe4953551ae2476c9.camel@freebsd.org> <13972.1621147890@critter.freebsd.dk> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Fjp3p2SCNz4lyc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 16:43:18 -0000 On Sun, 2021-05-16 at 06:51 +0000, Poul-Henning Kamp wrote: > -------- > Ian Lepore writes: > > > On Sat, 2021-05-15 at 20:14 +0000, Poul-Henning Kamp wrote: > > > The /dev/iic%d filedescriptor is opened and closed for every > > > single > > > command, in the hope that it will aid multiple separate programs > > > sharing I2C busses. I have not actually tried that yet, so it > > > may > > > need more work (exclusive opens etc.). > > > > There should be no need to do that. The i2c bus is arbitrated in > > iicbus/iiconf.c and most all the in-tree drivers now use either > > explicit iicbus_request_bus() calls, or use > > iicbus_transfer_excl(). > > Certainly users of iic(4) don't need to be protected from each > > other; > > everything in the driver that uses the bus does so inside of > > request_bus / release_bus calls. > > How does that work when i2c(8) (by default) issues discrete > start/stop commands ? > > Related to that: Should i2c(8)'s -m default be changed to 'tr' ? > Start locks the bus and stop releases it. Yeah, that's a marginal design, it lets userland keep everybody including kernel drivers off the bus indefinitely. i2c(8) is very much a "you have all the power, use it wisely" type of tool. -- Ian