On Tue, Jul 18, 2017 at 04:17:41PM +0800, AceLan Kao wrote: > Hi all, > > I'm working on a backlight driver which read/write commands through > standard UART port, but got some issues. > > 1. The UART port defined in BIOS/DSDT as HID="DELL0501" and > CID="PNP0501" and uses address 0x3F8 and IRQ 4, so the port will be > created by 8250_pnp driver as ttyS0. > > Name (_HID, "DELL0501") // _HID: Hardware ID > Name (_CID, EisaId ("PNP0501") /* 16550A-compatible > COM Serial Port */) // _CID: Compatible ID > Name (_DDN, "COM5") // _DDN: DOS Device Name > > 2. I can send/receive commands from userspace app by opening > /dev/ttyS0 to change the backlight brightness. This makes sure the > UART channel works. > > 3. What I want is to implement a driver which create a backlight > interface, so userspace GUI can access it without changing any code. > The driver is as attached. > > 4. The issue is that, I have to open and close the "/dev/ttyS0" before > inserting my driver. It can be done by userspace app(on some system, > systemd check/open every serial ports automatically after booting up) > or done in the driver by filp_open(). If the port(ttyS0) doesn't be > opened before inserting my driver, I can't read any data from UART. > And after inserting my driver, the ttyS0 won't respond any commands I > sent from userspace app. > > I have no idea why it doesn't work, and I'm not pretty sure if I did > it correct. Please help me to check it. > Thanks. Why not use the serdev interface, or see how the speakup subsystem handles talking to serial ports. That might help you out here. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html