View | Details | Raw Unified | Return to bug 119227
Collapse All | Expand All

(-)ubsa.c (-33 / +48 lines)
Lines 25-31 Link Here
25
 */
25
 */
26
26
27
#include <sys/cdefs.h>
27
#include <sys/cdefs.h>
28
__FBSDID("$FreeBSD: src/sys/dev/usb/ubsa.c,v 1.17 2005/01/06 01:43:28 imp Exp $");
28
__FBSDID("$FreeBSD: src/sys/dev/usb/ubsa.c,v 1.25 2007/06/09 06:39:43 imp Exp $");
29
/*-
29
/*-
30
 * Copyright (c) 2001 The NetBSD Foundation, Inc.
30
 * Copyright (c) 2001 The NetBSD Foundation, Inc.
31
 * All rights reserved.
31
 * All rights reserved.
Lines 93-103 Link Here
93
93
94
#include <dev/usb/ucomvar.h>
94
#include <dev/usb/ucomvar.h>
95
95
96
#ifdef USB_DEBUG
97
Static int	ubsadebug = 0;
98
SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa");
96
SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa");
99
SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW,
97
100
	   &ubsadebug, 0, "ubsa debug level");
98
#ifdef USB_DEBUG
101
99
102
#define	DPRINTFN(n, x)	do { \
100
#define	DPRINTFN(n, x)	do { \
103
				if (ubsadebug > (n)) \
101
				if (ubsadebug > (n)) \
Lines 106-111 Link Here
106
#else
104
#else
107
#define	DPRINTFN(n, x)
105
#define	DPRINTFN(n, x)
108
#endif
106
#endif
107
Static int ubsadebug = 0;
108
SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW,
109
   &ubsadebug, 0, "ubsa debug level");
110
int ubsaibufsize = 4096;
111
int ubsaobufsize = 256;
112
TUNABLE_INT("hw.usb.ubsa.ibufsize", &ubsaibufsize);
113
TUNABLE_INT("hw.usb.ubsa.obufsize", &ubsaobufsize);
114
SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, ibufsize, CTLFLAG_RD,
115
   &ubsaibufsize, 0, "ubsa input packet length");
116
SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, obufsize, CTLFLAG_RD,
117
   &ubsaobufsize, 0, "ubsa output packet length");
118
#define UBSAIBUFSIZE (ubsaibufsize)
119
#define UBSAOBUFSIZE (ubsaobufsize)
109
#define	DPRINTF(x) DPRINTFN(0, x)
120
#define	DPRINTF(x) DPRINTFN(0, x)
110
121
111
#define	UBSA_MODVER		1	/* module version */
122
#define	UBSA_MODVER		1	/* module version */
Lines 214-219 Link Here
214
	uint16_t	vendor;
225
	uint16_t	vendor;
215
	uint16_t	product;
226
	uint16_t	product;
216
} ubsa_products [] = {
227
} ubsa_products [] = {
228
/* AnyData ADU-E100A/H */
229
{ USB_VENDOR_ANYDATA, USB_PRODUCT_ANYDATA_ADU_E100X },
217
	/* BELKIN F5U103 */
230
	/* BELKIN F5U103 */
218
	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 },
231
	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 },
219
	/* BELKIN F5U120 */
232
	/* BELKIN F5U120 */
Lines 224-231 Link Here
224
	{ USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 },
237
	{ USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 },
225
	/* Peracom */
238
	/* Peracom */
226
	{ USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 },
239
	{ USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 },
227
	/* Vodafone */
240
/* Novatel Wireless Merlin cards */
228
	{ USB_VENDOR_VODAFONE, USB_PRODUCT_VODAFONE_MC3G },
241
{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 },
242
/* Option Vodafone MC3G */
243
{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G },
244
/* Option GlobeTrotter 3G */
245
{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },
246
/* Option GlobeTrotter 3G QUAD */
247
{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },
248
/* Huawei Mobile */
249
{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },
229
	{ 0, 0 }
250
	{ 0, 0 }
230
};
251
};
231
252
Lines 277-293 Link Here
277
	usb_config_descriptor_t *cdesc;
298
	usb_config_descriptor_t *cdesc;
278
	usb_interface_descriptor_t *id;
299
	usb_interface_descriptor_t *id;
279
	usb_endpoint_descriptor_t *ed;
300
	usb_endpoint_descriptor_t *ed;
280
	char *devinfo;
281
	const char *devname;
301
	const char *devname;
282
	usbd_status err;
302
	usbd_status err;
283
	int i;
303
	int i;
284
304
285
	dev = uaa->device;
305
	dev = uaa->device;
286
	devinfo = malloc(1024, M_USBDEV, M_WAITOK);
287
	ucom = &sc->sc_ucom;
306
	ucom = &sc->sc_ucom;
288
307
289
	bzero(sc, sizeof (struct ubsa_softc));
290
291
	/*
308
	/*
292
	 * initialize rts, dtr variables to something
309
	 * initialize rts, dtr variables to something
293
	 * different from boolean 0, 1
310
	 * different from boolean 0, 1
Lines 295-311 Link Here
295
	sc->sc_dtr = -1;
312
	sc->sc_dtr = -1;
296
	sc->sc_rts = -1;
313
	sc->sc_rts = -1;
297
314
298
	usbd_devinfo(dev, 0, devinfo);
299
	/* USB_ATTACH_SETUP; */
300
	ucom->sc_dev = self;
315
	ucom->sc_dev = self;
301
	device_set_desc_copy(self, devinfo);
302
	/* USB_ATTACH_SETUP; */
303
316
304
	ucom->sc_udev = dev;
317
	ucom->sc_udev = dev;
305
	ucom->sc_iface = uaa->iface;
318
	ucom->sc_iface = uaa->iface;
306
319
307
	devname = USBDEVNAME(ucom->sc_dev);
320
devname = device_get_nameunit(ucom->sc_dev);
308
	printf("%s: %s\n", devname, devinfo);
309
321
310
	DPRINTF(("ubsa attach: sc = %p\n", sc));
322
	DPRINTF(("ubsa attach: sc = %p\n", sc));
311
323
Lines 328-334 Link Here
328
340
329
	if (cdesc == NULL) {
341
	if (cdesc == NULL) {
330
		printf("%s: failed to get configuration descriptor\n",
342
		printf("%s: failed to get configuration descriptor\n",
331
		    USBDEVNAME(ucom->sc_dev));
343
    device_get_nameunit(ucom->sc_dev));
332
		ucom->sc_dying = 1;
344
		ucom->sc_dying = 1;
333
		goto error;
345
		goto error;
334
	}
346
	}
Lines 352-358 Link Here
352
		ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
364
		ed = usbd_interface2endpoint_descriptor(ucom->sc_iface, i);
353
		if (ed == NULL) {
365
		if (ed == NULL) {
354
			printf("%s: no endpoint descriptor for %d\n",
366
			printf("%s: no endpoint descriptor for %d\n",
355
			    USBDEVNAME(ucom->sc_dev), i);
367
    device_get_nameunit(ucom->sc_dev), i);
356
			ucom->sc_dying = 1;
368
			ucom->sc_dying = 1;
357
			goto error;
369
			goto error;
358
		}
370
		}
Lines 364-380 Link Here
364
		} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
376
		} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
365
		    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
377
		    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
366
			ucom->sc_bulkin_no = ed->bEndpointAddress;
378
			ucom->sc_bulkin_no = ed->bEndpointAddress;
379
if (uaa->product == USB_PRODUCT_ANYDATA_ADU_E100X)
380
ucom->sc_ibufsize = UBSAIBUFSIZE; //UGETW(ed->wMaxPacketSize);
381
else
367
			ucom->sc_ibufsize = UGETW(ed->wMaxPacketSize);
382
			ucom->sc_ibufsize = UGETW(ed->wMaxPacketSize);
368
		} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
383
		} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
369
		    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
384
		    UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
370
			ucom->sc_bulkout_no = ed->bEndpointAddress;
385
			ucom->sc_bulkout_no = ed->bEndpointAddress;
386
if (uaa->product == USB_PRODUCT_ANYDATA_ADU_E100X)
387
ucom->sc_obufsize = UBSAOBUFSIZE; //UGETW(ed->wMaxPacketSize);
388
else
371
			ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
389
			ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
372
		}
390
		}
373
	}
391
	}
374
392
375
	if (sc->sc_intr_number == -1) {
393
	if (sc->sc_intr_number == -1) {
376
		printf("%s: Could not find interrupt in\n",
394
		printf("%s: Could not find interrupt in\n",
377
		    USBDEVNAME(ucom->sc_dev));
395
    device_get_nameunit(ucom->sc_dev));
378
		ucom->sc_dying = 1;
396
		ucom->sc_dying = 1;
379
		goto error;
397
		goto error;
380
	}
398
	}
Lines 384-397 Link Here
384
402
385
	if (ucom->sc_bulkin_no == -1) {
403
	if (ucom->sc_bulkin_no == -1) {
386
		printf("%s: Could not find data bulk in\n",
404
		printf("%s: Could not find data bulk in\n",
387
		    USBDEVNAME(ucom->sc_dev));
405
    device_get_nameunit(ucom->sc_dev));
388
		ucom->sc_dying = 1;
406
		ucom->sc_dying = 1;
389
		goto error;
407
		goto error;
390
	}
408
	}
391
409
392
	if (ucom->sc_bulkout_no == -1) {
410
	if (ucom->sc_bulkout_no == -1) {
393
		printf("%s: Could not find data bulk out\n",
411
		printf("%s: Could not find data bulk out\n",
394
		    USBDEVNAME(ucom->sc_dev));
412
    device_get_nameunit(ucom->sc_dev));
395
		ucom->sc_dying = 1;
413
		ucom->sc_dying = 1;
396
		goto error;
414
		goto error;
397
	}
415
	}
Lines 408-419 Link Here
408
426
409
	TASK_INIT(&sc->sc_task, 0, ubsa_notify, sc); 
427
	TASK_INIT(&sc->sc_task, 0, ubsa_notify, sc); 
410
	ucom_attach(ucom);
428
	ucom_attach(ucom);
411
412
	free(devinfo, M_USBDEV);
413
	USB_ATTACH_SUCCESS_RETURN;
429
	USB_ATTACH_SUCCESS_RETURN;
414
430
415
error:
431
error:
416
	free(devinfo, M_USBDEV);
417
	USB_ATTACH_ERROR_RETURN;
432
	USB_ATTACH_ERROR_RETURN;
418
}
433
}
419
434
Lines 456-462 Link Here
456
	err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
471
	err = usbd_do_request(sc->sc_ucom.sc_udev, &req, 0);
457
	if (err)
472
	if (err)
458
		printf("%s: ubsa_request: %s\n",
473
		printf("%s: ubsa_request: %s\n",
459
		    USBDEVNAME(sc->sc_ucom.sc_dev), usbd_errstr(err));
474
    device_get_nameunit(sc->sc_ucom.sc_dev), usbd_errstr(err));
460
	return (err);
475
	return (err);
461
}
476
}
462
477
Lines 542-548 Link Here
542
	default:
557
	default:
543
		printf("%s: ubsa_param: unsupported baudrate, "
558
		printf("%s: ubsa_param: unsupported baudrate, "
544
		    "forcing default of 9600\n",
559
		    "forcing default of 9600\n",
545
		    USBDEVNAME(sc->sc_ucom.sc_dev));
560
    device_get_nameunit(sc->sc_ucom.sc_dev));
546
		value = B230400 / B9600;
561
		value = B230400 / B9600;
547
		break;
562
		break;
548
	};
563
	};
Lines 585-591 Link Here
585
	default:
600
	default:
586
		printf("%s: ubsa_param: unsupported databits requested, "
601
		printf("%s: ubsa_param: unsupported databits requested, "
587
		    "forcing default of 8\n",
602
		    "forcing default of 8\n",
588
		    USBDEVNAME(sc->sc_ucom.sc_dev));
603
    device_get_nameunit(sc->sc_ucom.sc_dev));
589
		value = 3;
604
		value = 3;
590
	}
605
	}
591
606
Lines 663-669 Link Here
663
		    UBSA_INTR_INTERVAL);
678
		    UBSA_INTR_INTERVAL);
664
		if (err) {
679
		if (err) {
665
			printf("%s: cannot open interrupt pipe (addr %d)\n",
680
			printf("%s: cannot open interrupt pipe (addr %d)\n",
666
			    USBDEVNAME(sc->sc_ucom.sc_dev),
681
    device_get_nameunit(sc->sc_ucom.sc_dev),
667
			    sc->sc_intr_number);
682
			    sc->sc_intr_number);
668
			return (EIO);
683
			return (EIO);
669
		}
684
		}
Lines 688-699 Link Here
688
		err = usbd_abort_pipe(sc->sc_intr_pipe);
703
		err = usbd_abort_pipe(sc->sc_intr_pipe);
689
		if (err)
704
		if (err)
690
			printf("%s: abort interrupt pipe failed: %s\n",
705
			printf("%s: abort interrupt pipe failed: %s\n",
691
			    USBDEVNAME(sc->sc_ucom.sc_dev),
706
    device_get_nameunit(sc->sc_ucom.sc_dev),
692
			    usbd_errstr(err));
707
			    usbd_errstr(err));
693
		err = usbd_close_pipe(sc->sc_intr_pipe);
708
		err = usbd_close_pipe(sc->sc_intr_pipe);
694
		if (err)
709
		if (err)
695
			printf("%s: close interrupt pipe failed: %s\n",
710
			printf("%s: close interrupt pipe failed: %s\n",
696
			    USBDEVNAME(sc->sc_ucom.sc_dev),
711
    device_get_nameunit(sc->sc_ucom.sc_dev),
697
			    usbd_errstr(err));
712
			    usbd_errstr(err));
698
		free(sc->sc_intr_buf, M_USBDEV);
713
		free(sc->sc_intr_buf, M_USBDEV);
699
		sc->sc_intr_pipe = NULL;
714
		sc->sc_intr_pipe = NULL;
Lines 716-722 Link Here
716
			return;
731
			return;
717
732
718
		DPRINTF(("%s: ubsa_intr: abnormal status: %s\n",
733
		DPRINTF(("%s: ubsa_intr: abnormal status: %s\n",
719
		    USBDEVNAME(sc->sc_ucom.sc_dev),
734
    device_get_nameunit(sc->sc_ucom.sc_dev),
720
		    usbd_errstr(status)));
735
		    usbd_errstr(status)));
721
		usbd_clear_endpoint_stall_async(sc->sc_intr_pipe);
736
		usbd_clear_endpoint_stall_async(sc->sc_intr_pipe);
722
		return;
737
		return;
Lines 727-733 Link Here
727
	sc->sc_msr = buf[3];
742
	sc->sc_msr = buf[3];
728
743
729
	DPRINTF(("%s: ubsa lsr = 0x%02x, msr = 0x%02x\n",
744
	DPRINTF(("%s: ubsa lsr = 0x%02x, msr = 0x%02x\n",
730
	    USBDEVNAME(sc->sc_ucom.sc_dev), sc->sc_lsr, sc->sc_msr));
745
    device_get_nameunit(sc->sc_ucom.sc_dev), sc->sc_lsr, sc->sc_msr));
731
746
732
	taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task);
747
	taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task);
733
}
748
}
(-)usb_quirks.c (+2 lines)
Lines 103-108 Link Here
103
	ANY, { UQ_ASSUME_CM_OVER_DATA }},
103
	ANY, { UQ_ASSUME_CM_OVER_DATA }},
104
 { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_AS64LX,
104
 { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_AS64LX,
105
	0x100, { UQ_ASSUME_CM_OVER_DATA }},
105
	0x100, { UQ_ASSUME_CM_OVER_DATA }},
106
 { USB_VENDOR_SIEMENSMOBILE, USB_PRODUCT_SIEMENSMOBILE_ES75,
107
	ANY, { UQ_ASSUME_CM_OVER_DATA }},
106
 { USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_A41XV32X,
108
 { USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_A41XV32X,
107
	ANY, { UQ_ASSUME_CM_OVER_DATA }},
109
	ANY, { UQ_ASSUME_CM_OVER_DATA }},
108
 /* Devices which should be ignored by uhid */
110
 /* Devices which should be ignored by uhid */
(-)usbdevs (+15 lines)
Lines 546-551 Link Here
546
vendor SITECOM		0x6189	Sitecom
546
vendor SITECOM		0x6189	Sitecom
547
vendor INTEL		0x8086	Intel
547
vendor INTEL		0x8086	Intel
548
vendor HP2		0xf003	Hewlett Packard
548
vendor HP2		0xf003	Hewlett Packard
549
vendor SIEMENSMOBILE   0x0681  SiemensMobile
550
vendor ANYDATA         0x16d5  AnyDATA Corporation
551
vendor NOVATEL          0x1410  Novatel Wireless
552
vendor OPTION           0x0af0  Option
553
vendor HUAWEI           0x12d1  Huawei Technologies
549
554
550
/*
555
/*
551
 * List of known products.  Grouped by vendor.
556
 * List of known products.  Grouped by vendor.
Lines 1506-1511 Link Here
1506
1511
1507
/* Siemens products */
1512
/* Siemens products */
1508
product SIEMENS SPEEDSTREAM	0x1001	SpeedStream USB
1513
product SIEMENS SPEEDSTREAM	0x1001	SpeedStream USB
1514
product SIEMENSMOBILE   ES75    0x0034  GSM module MC35
1515
1516
/* Option products */
1517
product NOVATEL U740            0x1400  Merlin U740
1518
product OPTION VODAFONEMC3G     0x5000  Vodafone Mobile Connect 3G datacard
1519
product OPTION GT3G             0x6000  GlobeTrotter 3G datacard
1520
product OPTION GT3GQUAD         0x6300  GlobeTrotter 3G QUAD datacard
1521
product ANYDATA ADU_E100X       0x6501  CDMA 2000 1xRTT/EV-DO USB Modem
1522
/* HUAWEI products */
1523
product HUAWEI MOBILE           0x1001  Huawei Mobile
1509
1524
1510
/* Sierra Wireless products */
1525
/* Sierra Wireless products */
1511
product SIERRA MC5720		0x0218	MC5720 Wireless Modem
1526
product SIERRA MC5720		0x0218	MC5720 Wireless Modem

Return to bug 119227