Re: ax88772b support for axe(4)

2011-10-20 Thread Jonathan Gray
Comments inline

On Wed, Oct 19, 2011 at 10:53:32PM -0500, joshua stein wrote:
> this adds support to axe(4) for the ax88772b usb ethernet adapter
> that came with my asus ux21.
> 
> it adds the usb device and an ax88772b-specific register that
> freebsd sets[1].
> 
> according to linux[2], the ax88772b only uses 11 bits of the header
> for the actual packet size and the other bits are used for something
> else.  older chips didn't use those extra 5 bits, so they didn't
> produce length mismatches.  this makes the length checks only look
> at 11 bits.
> 
> tested and working on the ax88772b with no input errors.  tested and
> still working on an older apple ax88772 usb adapter.
> 
> 
> 1. 
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/usb/net/if_axe.c.diff?r1=1.37;r2=1.38
> and 
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/usb/net/if_axereg.h.diff?r1=1.7;r2=1.8
> 
> 2. 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=bca0beb9363f8487ac902931a50eb00180a2d14a
> 
> 
> Index: dev/usb/if_axe.c
> ===
> RCS file: /cvs/src/sys/dev/usb/if_axe.c,v
> retrieving revision 1.107
> diff -u -p -u -p -r1.107 if_axe.c
> --- dev/usb/if_axe.c  16 Sep 2011 17:20:07 -  1.107
> +++ dev/usb/if_axe.c  20 Oct 2011 03:51:24 -
> @@ -150,6 +150,7 @@ const struct axe_type axe_devs[] = {
>   { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88172}, 0 },
>   { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772}, AX772 },
>   { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772A}, AX772 },
> + { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772B}, AX772 | AX772B },
>   { { USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88178}, AX178 },
>   { { USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC210T}, 0 },
>   { { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D5055 }, AX178 },
> @@ -765,6 +766,8 @@ axe_attach(struct device *parent, struct
>   printf("%s:", sc->axe_dev.dv_xname);
>   if (sc->axe_flags & AX178)
>   printf(" AX88178");
> + else if (sc->axe_flags & AX772B)
> + printf(" AX88772B");
>   else if (sc->axe_flags & AX772)
>   printf(" AX88772");
>   else
> @@ -1025,11 +1028,11 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_pr
>   memcpy(&hdr, buf, sizeof(hdr));
>   total_len -= sizeof(hdr);
>  
> - if ((hdr.len ^ hdr.ilen) != 0x) {
> + if (((hdr.len & 0x07ff) ^ (hdr.ilen & 0x07ff)) != 
> 0x07ff) {
>   ifp->if_ierrors++;
>   goto done;
>   }
> - pktlen = letoh16(hdr.len);
> + pktlen = letoh16(hdr.len & 0x07ff);

please define the mask to something

>   if (pktlen > total_len) {
>   ifp->if_ierrors++;
>   goto done;
> @@ -1334,7 +1337,9 @@ axe_init(void *xsc)
>  
>   /* Enable receiver, set RX mode */
>   rxmode = AXE_RXCMD_MULTICAST|AXE_RXCMD_ENABLE;
> - if (sc->axe_flags & AX178 || sc->axe_flags & AX772) {
> + if (sc->axe_flags & AX772B)
> + rxmode |= AXE_772B_RXCMD_HDR_TYPE_1;
> + else if (sc->axe_flags & AX178 || sc->axe_flags & AX772) {
>   if (sc->axe_udev->speed == USB_SPEED_HIGH) {
>   /* largest possible USB buffer size for AX88178 */
>   rxmode |= AXE_178_RXCMD_MFB;
> Index: dev/usb/if_axereg.h
> ===
> RCS file: /cvs/src/sys/dev/usb/if_axereg.h,v
> retrieving revision 1.20
> diff -u -p -u -p -r1.20 if_axereg.h
> --- dev/usb/if_axereg.h   6 Dec 2010 04:41:39 -   1.20
> +++ dev/usb/if_axereg.h   20 Oct 2011 03:51:24 -
> @@ -149,6 +149,8 @@
>  
>  #defineAXE_PHY_NO_AX772_EPHY   0x10/* Embedded 10/100 PHY of 
> AX88772 */
>  
> +#define  AXE_772B_RXCMD_HDR_TYPE_1   0x0100
> +

The datasheet calls this RH1M, it would be nice to have

AXE_772B_RXCMD_RH1M instead, along with
#define  AXE_772B_RXCMD_RH2M   0x0200
#define  AXE_772B_RXCMD_RH3M   0x0400

It also says format 1 is the default, though it
can't hurt to set it again.


>  #define AXE_TIMEOUT  1000
>  #define AXE_172_BUFSZ1536
>  #define AXE_178_MIN_BUFSZ2048
> @@ -177,6 +179,7 @@ struct axe_type {
>   u_int16_t   axe_flags;
>  #define AX1780x0001  /* AX88178 */
>  #define AX7720x0002  /* AX88772 */
> +#define AX772B   0x0004  /* AX88772B */
>  };
>  
>  struct axe_softc;
> Index: dev/usb/usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.558
> diff -u -p -u -p -r1.558 usbdevs
> --- dev/usb/usbdevs   7 Oct 2011 06:01:49 -   1.558
> +++ dev/usb/usbdevs   20 Oct 2011 03:51:28 -
> @@ 

Re: dd disp option

2011-10-20 Thread Thomas Pfaff
On Thu, 20 Oct 2011 09:39:46 +0100
Stuart Henderson  wrote:
> dd is on the ramdisks, have you tested them at all?

No, I did not think about that, sorry, but this is a no-go anyway
as I was told that there will be no more non-standard options in dd.
I also promised myself to not nag about this so ... zip ;-)

> On 2011/10/19 21:12, Thomas Pfaff wrote:
> > This adds a new option disp that can be set to "human" for a more human-
> > readable completion message.  This does not change the current behavior.
> > 
> >   $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42 disp=human
> >   42+0 records in
> >   42+0 records out
> >   57501696 bytes (54.8MB) transferred in 0.161 seconds (340MB/s)
> > 
> >   $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42
> >   42+0 records in
> >   42+0 records out
> >   57501696 bytes transferred in 0.138 secs (415847262 bytes/sec)
> > 
> > You can add disp=legacy if you one day should decide to make disp=human
> > the default (yah).  Simple modification to scripts to keep them working.
[...]



Dell 5540 HSDPA

2011-10-20 Thread rivo nurges
Hi!

The diff below makes cdce(4) to recognize cdce part of my Dell 5540 mini-pcie
card.

cdce port must be enabled before use by sending following to one
of the serial ports(should it be somehow documented in the manpage?):

AT+CFUN=1 # enable radio
AT+CGDCONT=1,"IP","internet" # configure apn
AT*ENAP=1,1 # enable cdce port

umodem0 at uhub5 port 6 configuration 1 interface 1 "vendor, uaa->product) != NULL)
return (UMATCH_VENDOR_PRODUCT);
 
-   if (id->bInterfaceClass == UICLASS_CDC && id->bInterfaceSubClass ==
-   UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL)
+   if (id->bInterfaceClass == UICLASS_CDC && (
+   id->bInterfaceSubClass == 
UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL ||
+   id->bInterfaceSubClass == UISUBCLASS_MOBILE_DIRECT_LINE_MODEL))
return (UMATCH_IFACECLASS_GENERIC);
 
return (UMATCH_NONE);
Index: sys/dev/usb/usb.h
===
RCS file: /OpenBSD/src/sys/dev/usb/usb.h,v
retrieving revision 1.37
diff -u -p -r1.37 usb.h
--- sys/dev/usb/usb.h   4 Mar 2011 23:55:32 -   1.37
+++ sys/dev/usb/usb.h   20 Oct 2011 10:03:40 -
@@ -412,6 +412,7 @@ typedef struct {
 #define UISUBCLASS_CAPI_CONTROLMODEL   5
 #define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
 #define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
+#define UISUBCLASS_MOBILE_DIRECT_LINE_MODEL10
 #define   UIPROTO_CDC_AT   1
 
 #define UICLASS_HID0x03
Index: share/man/man4/cdce.4
===
RCS file: /OpenBSD/src/share/man/man4/cdce.4,v
retrieving revision 1.14
diff -u -p -r1.14 cdce.4
--- share/man/man4/cdce.4   14 Mar 2008 15:19:52 -  1.14
+++ share/man/man4/cdce.4   20 Oct 2011 10:03:40 -
@@ -46,6 +46,8 @@ including the following:
 .It
 Acer Labs USB 2.0 Data Link
 .It
+Dell Wireless 5540
+.It
 FRITZ!Box Fon ata 1020
 .It
 G.Mate YP3X00


-- 
rivo



Re: [new devices] Alcatel One Touch X210/X220

2011-10-20 Thread Stuart Henderson
On 2011/10/20 11:49, David Coppa wrote:
> The diff below add an entry for the Alcatel One Touch X220 (also
> good for the X210 which is more or less identical).
> 
> Tested with a X220 (it's the new usb modem my employer is giving
> to on-call sysadmins).
> 
> Ok?

Just "modem mode" is enough. No point bloating the kernel with names which
are going to be picked up from the device itself anyway.. Otherwise OK.

> -product TCTMOBILE UMSM   0x  Modem mode
> +product TCTMOBILE UMSM   0x  Modem mode (Alcatel One Touch 
> X060/X200)
> +product TCTMOBILE UMSM_2 0x0017  Modem mode (Alcatel One Touch X210/X220)



[new devices] Alcatel One Touch X210/X220

2011-10-20 Thread David Coppa
The diff below add an entry for the Alcatel One Touch X220 (also
good for the X210 which is more or less identical).

Tested with a X220 (it's the new usb modem my employer is giving
to on-call sysadmins).

Ok?

Cheers!
David

P.S.: is the naming sufficiently clear?


Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x), 
Intel(0x8086), rev 1.00
  uhub0
 port 1 powered
 port 2 powered
 port 3 addr 3: high speed, power 500 mA, config 1, HSPA Data Card(0x0017), 
USBModem(0x1bbb), rev 0.00, iSerialNumber 1234567890ABCDEF
   umass1
   ugen0

Before:

umsm0 at uhub0 port 3 configuration 1 interface 0 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
umsm0 detached
umass1 at uhub0 port 3 configuration 1 interface 4 "USBModem HSPA Data Card" 
rev 2.00/0.00 addr 3
umass1: using SCSI over Bulk-Only
scsibus4 at umass1: 2 targets, initiator 0
sd3 at scsibus4 targ 1 lun 0:  SCSI2 0/direct 
removable serial.1bbb0017567890ABCDEF
ugen0 at uhub0 port 3 configuration 1 "USBModem HSPA Data Card" rev 2.00/0.00 
addr 3

After:

umsm0 at uhub0 port 3 configuration 1 interface 0 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
umsm0 detached
umsm0 at uhub0 port 3 configuration 1 interface 0 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
ucom0 at umsm0
umsm1 at uhub0 port 3 configuration 1 interface 1 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
ucom1 at umsm1
umsm2 at uhub0 port 3 configuration 1 interface 2 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
ucom2 at umsm2
umsm3 at uhub0 port 3 configuration 1 interface 3 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
ucom3 at umsm3
umass1 at uhub0 port 3 configuration 1 interface 4 "USBModem HSPA Data Card" 
rev 2.00/0.00 addr 3
umass1: using SCSI over Bulk-Only
scsibus4 at umass1: 2 targets, initiator 0
sd3 at scsibus4 targ 1 lun 0:  SCSI2 0/direct 
removable serial.1bbb0017567890ABCDEF
umsm4 at uhub0 port 3 configuration 1 interface 5 "USBModem HSPA Data Card" rev 
2.00/0.00 addr 3
ucom4 at umsm4

# cu -l cuaU3
Connected
ATI
Manufacturer: TCT Mobile International Limited
Model: HSPA Data Card
Revision: S11B2400XX
IMEI: ***
+GCAP: +CGSM,+DS,+ES


Index: share/man/man4/umsm.4
===
RCS file: /cvs/src/share/man/man4/umsm.4,v
retrieving revision 1.73
diff -u -p -r1.73 umsm.4
--- share/man/man4/umsm.4   18 Oct 2011 08:28:58 -  1.73
+++ share/man/man4/umsm.4   20 Oct 2011 09:16:11 -
@@ -39,6 +39,8 @@ driver:
 .It Li "AirPrime PC5220" Ta "CardBus"
 .It Li "Alcatel One Touch X060" Ta "USB"
 .It Li "Alcatel One Touch X200" Ta "USB"
+.It Li "Alcatel One Touch X210" Ta "USB"
+.It Li "Alcatel One Touch X220" Ta "USB"
 .It Li "AnyDATA ADU-500A" Ta "USB"
 .It Li "AnyDATA ADU-E100H" Ta "USB"
 .It Li "AnyDATA A2502" Ta "USB"
Index: sys/dev/usb/umsm.c
===
RCS file: /cvs/src/sys/dev/usb/umsm.c,v
retrieving revision 1.79
diff -u -p -r1.79 umsm.c
--- sys/dev/usb/umsm.c  22 Jul 2011 11:37:09 -  1.79
+++ sys/dev/usb/umsm.c  20 Oct 2011 09:16:45 -
@@ -238,6 +238,7 @@ static const struct umsm_type umsm_devs[
 
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMASS }, DEV_UMASS3},
{{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMSM }, 0},
+   {{ USB_VENDOR_TCTMOBILE, USB_PRODUCT_TCTMOBILE_UMSM_2 }, 0},
 
{{ USB_VENDOR_TOSHIBA, USB_PRODUCT_TOSHIBA_HSDPA }, 0},
 
Index: sys/dev/usb/usbdevs
===
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.558
diff -u -p -r1.558 usbdevs
--- sys/dev/usb/usbdevs 7 Oct 2011 06:01:49 -   1.558
+++ sys/dev/usb/usbdevs 20 Oct 2011 09:16:49 -
@@ -3642,7 +3642,8 @@ product SWEEX ZD1211  0x1809  ZD1211
 product SYNTECH SERIAL 0x0001  Serial
 
 /* TCT Mobile products */
-product TCTMOBILE UMSM 0x  Modem mode
+product TCTMOBILE UMSM 0x  Modem mode (Alcatel One Touch X060/X200)
+product TCTMOBILE UMSM_2   0x0017  Modem mode (Alcatel One Touch X210/X220)
 product TCTMOBILE UMASS0xf000  Storage mode
 
 /* Tangtop products */



Re: dd disp option

2011-10-20 Thread Stuart Henderson
dd is on the ramdisks, have you tested them at all?


On 2011/10/19 21:12, Thomas Pfaff wrote:
> This adds a new option disp that can be set to "human" for a more human-
> readable completion message.  This does not change the current behavior.
> 
>   $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42 disp=human
>   42+0 records in
>   42+0 records out
>   57501696 bytes (54.8MB) transferred in 0.161 seconds (340MB/s)
> 
>   $ dd if=/dev/zero of=/tmp/kthxbye bs=1337K count=42
>   42+0 records in
>   42+0 records out
>   57501696 bytes transferred in 0.138 secs (415847262 bytes/sec)
> 
> You can add disp=legacy if you one day should decide to make disp=human
> the default (yah).  Simple modification to scripts to keep them working.
> 
> I know you're all thrilled seeing yet another dd diff from me, but rest
> assured; this is the last one ... for now ;-)
> 
> So, if anyone is interested:
> 
> Index: Makefile
> ===
> RCS file: /cvs/src/bin/dd/Makefile,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile
> --- Makefile  29 May 1998 04:34:20 -  1.5
> +++ Makefile  19 Oct 2011 18:50:31 -
> @@ -2,5 +2,7 @@
>  
>  PROG=dd
>  SRCS=args.c conv.c conv_tab.c dd.c misc.c position.c
> +DPADD= ${LIBUTIL}
> +LDADD= -lutil
>  
>  .include 
> Index: args.c
> ===
> RCS file: /cvs/src/bin/dd/args.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 args.c
> --- args.c18 Oct 2011 09:37:35 -  1.19
> +++ args.c19 Oct 2011 18:50:31 -
> @@ -53,6 +53,7 @@ static void f_bs(char *);
>  static void  f_cbs(char *);
>  static void  f_conv(char *);
>  static void  f_count(char *);
> +static void  f_disp(char *);
>  static void  f_files(char *);
>  static void  f_ibs(char *);
>  static void  f_if(char *);
> @@ -72,6 +73,7 @@ static const struct arg {
>   { "cbs",f_cbs,  C_CBS,   C_CBS },
>   { "conv",   f_conv, 0,   0 },
>   { "count",  f_count,C_COUNT, C_COUNT },
> + { "disp",   f_disp, 0,   0 },
>   { "files",  f_files,C_FILES, C_FILES },
>   { "ibs",f_ibs,  C_IBS,   C_BS|C_IBS },
>   { "if", f_if,   C_IF,C_IF },
> @@ -197,6 +199,14 @@ f_count(char *arg)
>  
>   if ((cpy_cnt = get_bsz(arg)) == 0)
>   cpy_cnt = (size_t)-1;
> +}
> +
> +static void
> +f_disp(char *arg)
> +{
> +
> + if ((disp_human = !strcmp(arg, "human")) != 1)
> + errx(1, "%s: illegal value", "disp");
>  }
>  
>  static void
> Index: dd.1
> ===
> RCS file: /cvs/src/bin/dd/dd.1,v
> retrieving revision 1.25
> diff -u -p -r1.25 dd.1
> --- dd.1  18 Oct 2011 09:37:35 -  1.25
> +++ dd.1  19 Oct 2011 18:50:31 -
> @@ -137,6 +137,13 @@ Otherwise, input data is read and discar
>  For pipes, the correct number of bytes is read.
>  For all other devices, the correct number of blocks is read without
>  distinguishing between a partial or complete block being read.
> +.It Cm disp= Ns Ar s
> +If
> +.Ar s
> +is
> +.Sq human
> +the completion message will be displayed in a more human-readable format
> +using the appropriate size suffixes.
>  .It Xo
>  .Sm off
>  .Cm conv= Ar value Oo ,
> @@ -371,6 +378,9 @@ specification.
>  .Pp
>  The
>  .Cm files
> +operand,
> +the
> +.Cm disp
>  operand,
>  the conversions
>  .Cm oldascii ,
> Index: extern.h
> ===
> RCS file: /cvs/src/bin/dd/extern.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 extern.h
> --- extern.h  25 Jun 2003 21:12:30 -  1.7
> +++ extern.h  19 Oct 2011 18:50:31 -
> @@ -57,6 +57,7 @@ extern STAT st;
>  extern void (*cfunc)(void);
>  extern size_t cpy_cnt;
>  extern size_t cbsz;
> +extern int disp_human;
>  extern u_int ddflags;
>  extern size_t files_cnt;
>  extern const u_char *ctab;
> Index: misc.c
> ===
> RCS file: /cvs/src/bin/dd/misc.c,v
> retrieving revision 1.16
> diff -u -p -r1.16 misc.c
> --- misc.c27 Oct 2009 23:59:21 -  1.16
> +++ misc.c19 Oct 2011 18:50:31 -
> @@ -45,10 +45,13 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "dd.h"
>  #include "extern.h"
>  
> +int  disp_human;
> +
>  void
>  summary(void)
>  {
> @@ -57,6 +60,7 @@ summary(void)
>   struct iovec iov[4];
>   double microsecs;
>   int i = 0;
> + char sizebuf[FMT_SCALED_STRSIZE], ratebuf[FMT_SCALED_STRSIZE];
>  
>   (void)gettimeofday(&nowtv, (struct timezone *)NULL);
>   timersub(&nowtv, &st.startv, &nowtv);
> @@ -85,10 +89,25 @@ summary(void)
>   iov[i].iov_base = buf[2];
>   iov[i++].iov_len = strlen(buf[2]);
>   }
> - (void)snprintf(buf[3], sizeof(buf[3]),
> - "%qd bytes transferred in %

查e5rl3fjq7收

2011-10-20 Thread mail...@tw.mtf.news.yahoo.com
 Your friend e/d:d8e  fg+ g5&d= e!!

g5&f(ggh(o<

f(e%=:

fe8g>f (g,e&if!o<h?d>o<i;h)3h+!

hg3;d::o<e< e% 136 o<o<o<o<3003c

o<1o<1o<79956o<o<o<o<

ih(o<f$f%ei7fego<h+geg(o<o<o<

m274t5

f%e5rl3fjq7f6
http://tw.myblog.yahoo.com/jw!1K84p1yREQXRDO9YOXH0EfAuoaYkEjm18Q--/article?mid=1

Yahoo!e%f)fe0 d= gfe0.ee3.gf4;f0i+i)c
http://tw.fashion.yahoo.com/
g   f,
f   f   Yahoo!e%f)