[NEW] ugold(4) driver for Microdia's USB TEMPer variant

2013-03-31 Thread SASANO Takayoshi
Hello,

I rewrote patched uthum(4) to new ugold(4) driver.
Thanks for advice by yuo@ and deraadt@.

The diff for -current's /usr/src/sys is large to send mailing-list,
so here is the URL:

http://www2192ue.sakura.ne.jp/~uaa/gomitext/2013/20130331/20130331.diff

If you want to try ugold(4) and already use Microdia's-variant-patched
uthum(4) driver, revert original uthum(4).

ok or comments, please.

Cheers,
-- 
SASANO Takayoshi u...@mx5.nisiq.net



add .cvsrc to skel

2013-03-31 Thread Marc Espie
Simple enough. Probably details of options to discuss. This is what
I use daily.

Index: Makefile
===
RCS file: /home/openbsd/cvs/src/etc/Makefile,v
retrieving revision 1.330
diff -u -p -r1.330 Makefile
--- Makefile26 Mar 2013 18:06:00 -  1.330
+++ Makefile31 Mar 2013 14:13:37 -
@@ -144,6 +144,8 @@ distribution-etc-root-var: distrib-dirs
${DESTDIR}/root/.profile; \
${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
${DESTDIR}/root/.Xdefaults; \
+   ${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
+   ${DESTDIR}/root/.cvsrc; \
rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
${DESTDIR}/.cshrc; \
@@ -160,6 +162,8 @@ distribution-etc-root-var: distrib-dirs
${DESTDIR}/etc/skel/.profile; \
${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
${DESTDIR}/etc/skel/.Xdefaults; \
+   ${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
+   ${DESTDIR}/etc/skel/.cvsrc; \
${INSTALL} -c -o root -g wheel -m 600 /dev/null \
${DESTDIR}/etc/skel/.ssh/authorized_keys
cd kerberosV; \
Index: skel/dot.cvsrc
===
RCS file: skel/dot.cvsrc
diff -N skel/dot.cvsrc
--- /dev/null   1 Jan 1970 00:00:00 -
+++ skel/dot.cvsrc  31 Mar 2013 14:12:13 -
@@ -0,0 +1,5 @@
+# $OpenBSD$
+#
+diff -uNp
+update -P
+checkout -P



Re: add .cvsrc to skel

2013-03-31 Thread Stuart Henderson
On 2013/03/31 16:17, Marc Espie wrote:
 +update -P

Do we want -Pd here?



Re: add .cvsrc to skel

2013-03-31 Thread Stuart Henderson
On 2013/03/31 16:17, Marc Espie wrote:
 +diff -uNp

oh, and there is one thing about -p as a default: it increases
the chances of a messed-up terminal if the file has binary crap in
it, as it does not do any strnvis() or similar.



Re: add .cvsrc to skel

2013-03-31 Thread Marc Espie
On Sun, Mar 31, 2013 at 03:22:01PM +0100, Stuart Henderson wrote:
 On 2013/03/31 16:17, Marc Espie wrote:
  +update -P
 
 Do we want -Pd here?

I'm not sure.  I think it would be surprising, especially if you have a
partial tree checked out.

-P will remove directories where files have been moved to the attic.
But say, if you just checkout a few directories from src, you may want to
update them without the -d.

Then again, not having new directories appear is almost as problematic as
having old stuff stay around.

I think we will need to reach consensus on that one.


Or maybe something like:
# cvs -f will ignore cvsrc contents
update -Pd



Re: add .cvsrc to skel

2013-03-31 Thread Marc Espie
On Sun, Mar 31, 2013 at 03:26:56PM +0100, Stuart Henderson wrote:
 On 2013/03/31 16:17, Marc Espie wrote:
  +diff -uNp
 
 oh, and there is one thing about -p as a default: it increases
 the chances of a messed-up terminal if the file has binary crap in
 it, as it does not do any strnvis() or similar.

We could (should) fix that. That's rather trivial to do...



Re: add .cvsrc to skel

2013-03-31 Thread Marc Espie
On Sun, Mar 31, 2013 at 04:32:05PM +0200, Marc Espie wrote:
 On Sun, Mar 31, 2013 at 03:26:56PM +0100, Stuart Henderson wrote:
  On 2013/03/31 16:17, Marc Espie wrote:
   +diff -uNp
  
  oh, and there is one thing about -p as a default: it increases
  the chances of a messed-up terminal if the file has binary crap in
  it, as it does not do any strnvis() or similar.
 
 We could (should) fix that. That's rather trivial to do...

Actually, no. It makes little sense. The diff itself doesn't encode its
input.  

The function name that -p outputs is just as dangerous as the source file
contents itself...



Re: add .cvsrc to skel

2013-03-31 Thread Mark Kettenis
 Date: Sun, 31 Mar 2013 15:22:01 +0100
 From: Stuart Henderson s...@spacehopper.org
 
 On 2013/03/31 16:17, Marc Espie wrote:
  +update -P
 
 Do we want -Pd here?

I don't.  If you have a cvs repository that uses modules and you only
check out a single module, -d will actually cause cvs update to check
out the entire repository instead of just the module.  The
gdb/binutils CVS repository is an example of such a repository.



Add alternate power changed event to acpithinkpad.c

2013-03-31 Thread Brian Callahan

Hi tech --

I just discovered that my Thinkpad (Edge E420) sends a 0x6040 event when 
the power cable is connected or removed.


Patch below handles it, works for me.

OK?

~Brian

Index: acpithinkpad.c
===
RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v
retrieving revision 1.29
diff -u -p -r1.29 acpithinkpad.c
--- acpithinkpad.c  22 Mar 2013 22:15:01 -  1.29
+++ acpithinkpad.c  31 Mar 2013 16:36:17 -
@@ -74,6 +74,7 @@
 #defineTHINKPAD_TABLET_PEN_INSERTED0x500b
 #defineTHINKPAD_TABLET_PEN_REMOVED 0x500c
 #defineTHINKPAD_POWER_CHANGED  0x6030
+#defineTHINKPAD_POWER_CHANGED_ALT  0x6040
 #defineTHINKPAD_BACKLIGHT_CHANGED  0x6050
 #defineTHINKPAD_SWITCH_WIRELESS0x7000

@@ -346,6 +347,7 @@ thinkpad_hotkey(struct aml_node *node, i
handled = 1;
break;
case THINKPAD_POWER_CHANGED:
+   case THINKPAD_POWER_CHANGED_ALT:
case THINKPAD_BACKLIGHT_CHANGED:
handled = 1;
break;



Re: add .cvsrc to skel

2013-03-31 Thread Stuart Henderson
On 2013/03/31 16:46, Marc Espie wrote:
 On Sun, Mar 31, 2013 at 04:32:05PM +0200, Marc Espie wrote:
  On Sun, Mar 31, 2013 at 03:26:56PM +0100, Stuart Henderson wrote:
   On 2013/03/31 16:17, Marc Espie wrote:
+diff -uNp
   
   oh, and there is one thing about -p as a default: it increases
   the chances of a messed-up terminal if the file has binary crap in
   it, as it does not do any strnvis() or similar.
  
  We could (should) fix that. That's rather trivial to do...
 
 Actually, no. It makes little sense. The diff itself doesn't encode its
 input.  
 
 The function name that -p outputs is just as dangerous as the source file
 contents itself...
 

You know what you're going to get if you edit a line with/near
lines like this and then diff it, but the function name can be a bit
unexpected (I had minor trouble with this in the past with update-patches
in ports). Not particularly major, just thought it worth mentioning if
we're talking about adding this to default config.



Re: add .cvsrc to skel

2013-03-31 Thread Marc Espie
On Sun, Mar 31, 2013 at 08:49:03PM +0100, Stuart Henderson wrote:
 On 2013/03/31 16:46, Marc Espie wrote:
  On Sun, Mar 31, 2013 at 04:32:05PM +0200, Marc Espie wrote:
   On Sun, Mar 31, 2013 at 03:26:56PM +0100, Stuart Henderson wrote:
On 2013/03/31 16:17, Marc Espie wrote:
 +diff -uNp

oh, and there is one thing about -p as a default: it increases
the chances of a messed-up terminal if the file has binary crap in
it, as it does not do any strnvis() or similar.
   
   We could (should) fix that. That's rather trivial to do...
  
  Actually, no. It makes little sense. The diff itself doesn't encode its
  input.  
  
  The function name that -p outputs is just as dangerous as the source file
  contents itself...
  
 
 You know what you're going to get if you edit a line with/near
 lines like this and then diff it, but the function name can be a bit
 unexpected (I had minor trouble with this in the past with update-patches
 in ports). Not particularly major, just thought it worth mentioning if
 we're talking about adding this to default config.

If it's really a valid concern, as far as I can tell, It's just a question of

Index: usr.bin/diff/diffreg.c
===
RCS file: /home/openbsd/cvs/src/usr.bin/diff/diffreg.c,v
retrieving revision 1.82
diff -u -p -r1.82 diffreg.c
--- usr.bin/diff/diffreg.c  8 Jul 2012 15:48:56 -   1.82
+++ usr.bin/diff/diffreg.c  31 Mar 2013 14:43:18 -
@@ -77,6 +77,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include vis.h
 
 #include diff.h
 #include pathnames.h
@@ -1329,7 +1330,8 @@ match_function(const long *f, int pos, F
if (!state)
state =  (public);
} else {
-   strlcpy(lastbuf, buf, sizeof lastbuf);
+   strnvis(lastbuf, buf, sizeof lastbuf,
+   VIS_SAFE);
if (state)
strlcat(lastbuf, state,
sizeof lastbuf);
Index: usr.bin/rcs/diff.c
===
RCS file: /home/openbsd/cvs/src/usr.bin/rcs/diff.c,v
retrieving revision 1.33
diff -u -p -r1.33 diff.c
--- usr.bin/rcs/diff.c  20 Apr 2011 19:34:16 -  1.33
+++ usr.bin/rcs/diff.c  31 Mar 2013 14:44:28 -
@@ -72,8 +72,10 @@
 #include stdarg.h
 #include stddef.h
 #include stdio.h
+#include stdlib.h
 #include string.h
 #include unistd.h
+#include vis.h
 
 #include buf.h
 #include diff.h
@@ -1176,10 +1178,8 @@ match_function(const long *f, int pos, F
if (!state)
state =  (public);
} else {
-   if (strlcpy(lastbuf, buf,
-   sizeof(lastbuf)) = sizeof(lastbuf))
-   errx(1,
-   match_function: strlcpy);
+   strnvis(lastbuf, buf, sizeof(lastbuf), 
+   VIS_SAFE);
lastmatchline = pos;
return lastbuf;
}



unduplicate udp checksum code

2013-03-31 Thread Alexander Bluhm
Hi,

Can we merge the duplicate IPv4 and IPv6 checksum checking code in
udp_input() into one block?

ok?

bluhm

Index: netinet/udp_usrreq.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.157
diff -u -p -r1.157 udp_usrreq.c
--- netinet/udp_usrreq.c31 Mar 2013 11:18:35 -  1.157
+++ netinet/udp_usrreq.c31 Mar 2013 19:57:21 -
@@ -259,12 +259,6 @@ udp_input(struct mbuf *m, ...)
if (ip)
save_ip = *ip;
 
-   /*
-* Checksum extended UDP header and data.
-* from W.R.Stevens: check incoming udp cksums even if
-*  udpcksum is not set.
-*/
-   savesum = uh-uh_sum;
 #ifdef INET6
if (ip6) {
/* Be proactive about malicious use of IPv4 mapped address */
@@ -273,14 +267,25 @@ udp_input(struct mbuf *m, ...)
/* XXX stat */
goto bad;
}
+   }
+#endif /* INET6 */
 
+   /*
+* Checksum extended UDP header and data.
+* from W.R.Stevens: check incoming udp cksums even if
+*  udpcksum is not set.
+*/
+   savesum = uh-uh_sum;
+   if (uh-uh_sum == 0) {
+   udpstat.udps_nosum++;
+#ifdef INET6
/*
 * In IPv6, the UDP checksum is ALWAYS used.
 */
-   if (uh-uh_sum == 0) {
-   udpstat.udps_nosum++;
+   if (ip6)
goto bad;
-   }
+#endif /* INET6 */
+   } else {
if ((m-m_pkthdr.csum_flags  M_UDP_CSUM_IN_OK) == 0) {
if (m-m_pkthdr.csum_flags  M_UDP_CSUM_IN_BAD) {
udpstat.udps_badsum++;
@@ -288,38 +293,23 @@ udp_input(struct mbuf *m, ...)
goto bad;
}
 
-   if ((uh-uh_sum = in6_cksum(m, IPPROTO_UDP,
-   iphlen, len))) {
-   udpstat.udps_badsum++;
-   goto bad;
-   }
-   } else {
-   m-m_pkthdr.csum_flags = ~M_UDP_CSUM_IN_OK;
-   udpstat.udps_inhwcsum++;
-   }
-   } else
+   if (ip)
+   uh-uh_sum = in4_cksum(m, IPPROTO_UDP,
+   iphlen, len);
+#ifdef INET6
+   else if (ip6)
+   uh-uh_sum = in6_cksum(m, IPPROTO_UDP,
+   iphlen, len);
 #endif /* INET6 */
-   if (uh-uh_sum) {
-   if ((m-m_pkthdr.csum_flags  M_UDP_CSUM_IN_OK) == 0) {
-   if (m-m_pkthdr.csum_flags  M_UDP_CSUM_IN_BAD) {
-   udpstat.udps_badsum++;
-   udpstat.udps_inhwcsum++;
-   m_freem(m);
-   return;
-   }
-
-   if ((uh-uh_sum = in4_cksum(m, IPPROTO_UDP,
-   iphlen, len))) {
+   if (uh-uh_sum != 0) {
udpstat.udps_badsum++;
-   m_freem(m);
-   return;
+   goto bad;
}
} else {
m-m_pkthdr.csum_flags = ~M_UDP_CSUM_IN_OK;
udpstat.udps_inhwcsum++;
}
-   } else
-   udpstat.udps_nosum++;
+   }
 
 #ifdef IPSEC
if (udpencap_enable  udpencap_port 



Re: add .cvsrc to skel

2013-03-31 Thread Alexander Hall

On 03/31/13 16:17, Marc Espie wrote:

+diff -uNp


yes


+update -P


I think auto-prune (-P) without auto-add (-d) could be surprising. 
Personally I'd rather go without this.



+checkout -P


I'm indifferent here. Being a non-frequent user of cvs checkout on an 
already checked out tree, I consulted cvs(1) which indicated it implied 
'-d' behaviour, so maybe it makes more sense here.


/Alexander