devmouse: produce signed msec timestamp in /dev/mouse, accept unsigned on write

This commit is contained in:
cinap_lenrek 2018-07-23 19:29:15 +02:00
parent 34c7af22c1
commit d07fb3261f
2 changed files with 3 additions and 3 deletions

View file

@ -291,7 +291,7 @@ mouseread(Chan *c, void *va, long n, vlong off)
b = 16;
else if (b == 16)
b = 8;
sprint(buf, "m%11d %11d %11d %11lud ",
sprint(buf, "m%11d %11d %11d %11ld ",
m.xy.x, m.xy.y, b, m.msec);
mouse.lastcounter = m.counter;
@ -448,7 +448,7 @@ mousewrite(Chan *c, void *va, long n, vlong)
if(*p == 0)
error(Eshort);
b = strtol(p, &p, 0);
msec = strtol(p, 0, 0);
msec = (ulong)strtoll(p, 0, 0);
if(msec == 0)
msec = TK2MS(MACHP(0)->ticks);

View file

@ -191,7 +191,7 @@ mouseread(Chan *c, void *va, long n, vlong off)
m = mouse.Mousestate;
unlock(&mouse);
sprint(buf, "m%11d %11d %11d %11lud ",
sprint(buf, "m%11d %11d %11d %11ld ",
m.xy.x, m.xy.y, m.buttons, m.msec);
mouse.lastcounter = m.counter;