Re: [PATCH] hid: avoid '\0' in hid debugfs events file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Mar 2010, Bruno Prémont wrote:

> When dumping /sys/kernel/debug/hid/$device/events '\0' characters show up
> (invisible if cat to console but shown by less or while looking at a dump
> file).
> These are due to hid_debug_event() adding strlen()+1 bytes to the ring
> buffer (e.g. including the trailing '\0').
> Any roll-over causes a '\0' as well as hid_debug_event() handles the ring
> buffers with HID_DEBUG_BUFSIZE-1 size while hid_debug_events_read() handles
> it with full HID_DEBUG_BUFSIZE size.

Applied, thanks.

> Signed-off-by: Bruno Prémont <bonbons@xxxxxxxxxxxxxxxxx>
> ---
> Note:
> The ring buffer overflow case (when tail crosses head) seems to be
> suboptimal at best.
> Would there be a good way to mark those cases so reader can know where
> data got lost. (though this might not be easy keeping the lockless
> design)

I agree that there might be better implementation. The circular buffer is 
merely the same to what we use in other userspace interfaces already (see 
original hiddev, for example). Plus this is only debugging interface, and 
with SIZE being 512, it's very unlikely that events will get lost.

But I don't think the lockless design is that important here, so if you 
are motivated to rewrite it to something better, I wouldn't object.

Thanks,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux