From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH] usb: misc: supports Apple Carplay driver Date: Wed, 14 Mar 2018 07:16:12 +0100 Message-ID: <20180314061612.GA17263@kroah.com> References: <1521007356-12306-1-git-send-email-chunfeng.yun@mediatek.com> <1521007356-12306-2-git-send-email-chunfeng.yun@mediatek.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1521007356-12306-2-git-send-email-chunfeng.yun@mediatek.com> Sender: linux-kernel-owner@vger.kernel.org To: Chunfeng Yun Cc: Matthias Brugger , Heikki Krogerus , Serge Semin , Guenter Roeck , Kate Stewart , Thomas Gleixner , Alan Stern , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org List-Id: linux-mediatek@lists.infradead.org On Wed, Mar 14, 2018 at 02:02:36PM +0800, Chunfeng Yun wrote: > The driver is used to support Apple carplay feature by a debugfs > interface which can force the driver to send a USB Vendor Request > of "Apple Device to Host Mode Switch" to switch Apple Device > into host mode. While I am all for crazy debugfs interfaces, I would _strongly_ suggest not doing that here for the main API to the device. I know Android is trying to prevent any new devices from even enabling debugfs, and as the file system requires root permissions by default, you are forcing any user of your new api to run as root, which is not a good idea either. Given that all you are doing here is a single usb control message, why does this even need to be a kernel driver at all? Can't you do the same thing from userspace with a simple libusb/usbfs program? Or even a simple script? thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: usb: misc: supports Apple Carplay driver From: Greg Kroah-Hartman Message-Id: <20180314061612.GA17263@kroah.com> Date: Wed, 14 Mar 2018 07:16:12 +0100 To: Chunfeng Yun Cc: Matthias Brugger , Heikki Krogerus , Serge Semin , Guenter Roeck , Kate Stewart , Thomas Gleixner , Alan Stern , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux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YW4ndCB5b3UgZG8gdGhlIHNhbWUKdGhpbmcgZnJvbSB1c2Vyc3Bh Y2Ugd2l0aCBhIHNpbXBsZSBsaWJ1c2IvdXNiZnMgcHJvZ3JhbT8gIE9yIGV2ZW4gYQpzaW1wbGUg c2NyaXB0PwoKdGhhbmtzLAoKZ3JlZyBrLWgKLS0tClRvIHVuc3Vic2NyaWJlIGZyb20gdGhpcyBs aXN0OiBzZW5kIHRoZSBsaW5lICJ1bnN1YnNjcmliZSBsaW51eC11c2IiIGluCnRoZSBib2R5IG9m IGEgbWVzc2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnCk1vcmUgbWFqb3Jkb21vIGlu Zm8gYXQgIGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbAo= From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh@linuxfoundation.org (Greg Kroah-Hartman) Date: Wed, 14 Mar 2018 07:16:12 +0100 Subject: [PATCH] usb: misc: supports Apple Carplay driver In-Reply-To: <1521007356-12306-2-git-send-email-chunfeng.yun@mediatek.com> References: <1521007356-12306-1-git-send-email-chunfeng.yun@mediatek.com> <1521007356-12306-2-git-send-email-chunfeng.yun@mediatek.com> Message-ID: <20180314061612.GA17263@kroah.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Mar 14, 2018 at 02:02:36PM +0800, Chunfeng Yun wrote: > The driver is used to support Apple carplay feature by a debugfs > interface which can force the driver to send a USB Vendor Request > of "Apple Device to Host Mode Switch" to switch Apple Device > into host mode. While I am all for crazy debugfs interfaces, I would _strongly_ suggest not doing that here for the main API to the device. I know Android is trying to prevent any new devices from even enabling debugfs, and as the file system requires root permissions by default, you are forcing any user of your new api to run as root, which is not a good idea either. Given that all you are doing here is a single usb control message, why does this even need to be a kernel driver at all? Can't you do the same thing from userspace with a simple libusb/usbfs program? Or even a simple script? thanks, greg k-h