On Sun, Feb 13, 2011 at 09:04:40PM -0800, Ping Cheng wrote: > On Sun, Feb 13, 2011 at 7:53 PM, Peter Hutterer > <peter.hutte...@who-t.net>wrote: > > > On Fri, Feb 11, 2011 at 05:07:46PM -0800, Ping Cheng wrote: > > > "Error reading wacom device : device not found" is displayed in > > > Xorg.0.log 10 times each time a device is unplugged. This is too > > > much for those who unplugging the device many times a day. > > > > > > So, move it to DBG level 1 for a less noisy log file. Also added > > > errno to the log message since users would like to see the errno > > > instead of just the strerror. > > > > > > Signed-off-by: Ping Cheng <pingli...@gmail.com> > > > --- > > > src/xf86Wacom.c | 12 ++++++++---- > > > 1 files changed, 8 insertions(+), 4 deletions(-) > > > > > > diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c > > > index 03eb8df..d31c9f3 100644 > > > --- a/src/xf86Wacom.c > > > +++ b/src/xf86Wacom.c > > > @@ -791,10 +791,14 @@ void wcmReadPacket(InputInfoPtr pInfo) > > > > > > if (len <= 0) > > > { > > > - /* for all other errors, hope that the hotplugging code > > will > > > - * remove the device */ > > > - if (errno != EAGAIN && errno != EINTR) > > > - xf86Msg(X_ERROR, "%s: Error reading wacom device : > > %s\n", pInfo->name, strerror(errno)); > > > + if (errno != EAGAIN && errno != EINTR) > > > + /* The hotplugging code will remove the device */ > > > + DBG(1, priv, "Error reading wacom device : > > %s(%d)\n", > > > + strerror(errno), errno); > > > + else > > > + /* We'll read it again */ > > > + DBG(10, priv, "Reading wacom device interrupted: > > %s(%d)\n", > > > + strerror(errno), errno); > > > > this would absolutely swamp the log, wouldn't it? iirc we run until we get > > EAGAIN each time we run the event loop so we'd get log messages on nearly > > every event here. > > > > We do not get to EAGAIN or EINTR during normal read. I don't know why.
On USB devices, that doesn't suprise me (we check if there is data available and then read). since the kernel guarantees struct input_event size data when data is available, we don't hit EAGAIN. Have you tried this on a serial device though? > That's why users wanted to know the errno so they can tell what errno they > are getting. > > Can we change 10 -> 12 so they can still see errno if they want? > > > > return; > > > } > > > > > > -- > > > 1.7.4 > > > > how about something like this: > > > > static int warn_once = 0; > > > > if (!warn_once) > > warn_once = 1; > > > > if (warn_once) > > xf86Msg(X_ERROR, ...); > > elseo > > DBG(...); > > > > I really need those error messages, they're often the only indicator I see > > when someone has removed the device (and debugging isn't enabled/compiled > > in). I agree that seeing 10 of them is rather pointless, but one needs to > > be > > there. > > > > Very good idea. But, I don't think the above block will only give us once. > Do you mean: > > ----------- > static int warn_once = 0; > > if (!warn_once) > xf86Msg(X_ERROR, ...); > else > DBG(...); > > warn_once = 1; > ------------- whoops, yes, of course. though the warn_once = 1 should be in the else block. > If we can have it once, we do not need to duplicate the others into DBG any > more. What do you think? agreed, once is enough. > P.S., I have another patch for wcmUSB.c that is related to resolution. I am > having an awful time to access sf.net at home... sf seems to be in trouble since the breakin. the wiki was a bit slower than usual today but other than that I haven't noticed much. Cheers, Peter ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel