Hi!

Oops, forgot to attach the patch.

--- sys/dev/usb/umodem.c.orig   2006-08-05 22:21:42.000000000 +0800
+++ sys/dev/usb/umodem.c        2007-09-26 01:56:35.000000000 +0800
@@ -178,7 +178,7 @@
 Static usbd_status umodem_set_line_coding(struct umodem_softc *sc,
                                          usb_cdc_line_state_t *state);
 
-Static void    umodem_get_caps(usbd_device_handle, int *, int *);
+Static int     umodem_get_caps(usbd_device_handle, int *, int *);
 
 Static void    umodem_get_status(void *, int portno, u_char *lsr, u_char *msr);
 Static void    umodem_set(void *, int, int, int);
@@ -261,10 +261,7 @@
        if (ret == UMATCH_NONE)
                return (ret);
 
-       umodem_get_caps(uaa->device, &cm, &acm);
-       if (!(cm & USB_CDC_CM_DOES_CM) ||
-           !(cm & USB_CDC_CM_OVER_DATA) ||
-           !(acm & USB_CDC_ACM_HAS_LINE))
+       if (umodem_get_caps(uaa->device, &cm, &acm) == -1)
                return (UMATCH_NONE);
 
        return ret;
@@ -276,7 +273,6 @@
        usbd_device_handle dev = uaa->device;
        usb_interface_descriptor_t *id;
        usb_endpoint_descriptor_t *ed;
-       usb_cdc_cm_descriptor_t *cmd;
        char *devinfo = NULL;
        const char *devname;
        usbd_status err;
@@ -304,15 +300,15 @@
          id->bInterfaceClass, id->bInterfaceSubClass);
        sc->sc_ctl_iface_no = id->bInterfaceNumber;
 
-       umodem_get_caps(dev, &sc->sc_cm_cap, &sc->sc_acm_cap);
-
        /* Get the data interface no. */
-       cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM);
-       if (cmd == NULL) {
-               printf("%s: no CM descriptor\n", devname);
+       sc->sc_data_iface_no = data_ifcno =
+           umodem_get_caps(dev, &sc->sc_cm_cap, &sc->sc_acm_cap);
+
+       if (data_ifcno == -1) {
+               printf("%s: no pointer to data interface\n",
+               USBDEVNAME(sc->sc_dev));
                goto bad;
        }
-       sc->sc_data_iface_no = data_ifcno = cmd->bDataInterface;
 
        printf("%s: data interface %d, has %sCM over data, has %sbreak\n",
               devname, data_ifcno,
@@ -550,27 +546,35 @@
        ucom_status_change(&sc->sc_ucom);
 }
 
-void
+int
 umodem_get_caps(usbd_device_handle dev, int *cm, int *acm)
 {
        usb_cdc_cm_descriptor_t *cmd;
        usb_cdc_acm_descriptor_t *cad;
+       usb_cdc_union_descriptor_t *cud;
 
        *cm = *acm = 0;
 
        cmd = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM);
        if (cmd == NULL) {
                DPRINTF(("umodem_get_desc: no CM desc\n"));
-               return;
+       } else {
+               *cm = cmd->bmCapabilities;
        }
-       *cm = cmd->bmCapabilities;
 
        cad = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM);
        if (cad == NULL) {
                DPRINTF(("umodem_get_desc: no ACM desc\n"));
-               return;
+       } else {
+               *acm = cad->bmCapabilities;
+       }
+       
+       cud = umodem_get_desc(dev, UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION);
+       if (cud == NULL) {
+               DPRINTF(("umodem_get_desc: no UNION desc\n"));
        }
-       *acm = cad->bmCapabilities;
+       
+       return cmd ? cmd->bDataInterface : cud ? cud->bSlaveInterface[0] : -1;
 }
 
 void
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to