Commit Graph

169 Commits

Author SHA1 Message Date
Nick Hibma
da016e84de Implement modem control in u3g. Tested on Option GTM382W, Huawei E220,
and Sierra Wireless MC8790V. Also implement the .ucom_poll method.

Note: This makes it possible to use lqr/echo in ppp.conf. And it
resolves ppp hanging during the PPp> phase.

Reviewed by:	hps
MFC after:	1 week
2012-10-14 19:15:54 +00:00
Hans Petter Selasky
3c12706c5e Correct driver name.
MFC after:	1 weeks
2012-09-23 09:39:04 +00:00
Kevin Lo
26f370d011 Fix typo: s/protocl/protocol 2012-09-20 10:07:31 +00:00
Kevin Lo
92665d2b55 Restart the USB transfer if the error is not USB_ERR_CANCELLED. 2012-09-12 07:59:28 +00:00
Gavin Atkinson
5163813777 Support another uchcom(4) device.
MFC after:	1 week
2012-09-04 23:13:24 +00:00
Hans Petter Selasky
6623910e4a Add new USB device ID.
Submitted by:	Dmitry Luhtionov
MFC after:	1 week
2012-08-22 18:30:13 +00:00
Hans Petter Selasky
c01fc06ee9 Revert r239178 and implement two new functions, namely
"device_free_softc()" and "device_claim_softc()",
to allow USB serial drivers refcounting the softc.
These functions are used to grab the softc from
auto-free and to free the softc back to the correct
malloc type, respectivly.

Discussed with:	jhb
MFC after:	2 weeks
2012-08-15 15:42:57 +00:00
Gavin Atkinson
c64253a898 Rename command defines to match names used in the datasheet, in order to
make maintaining this driver from the documentation easier in the future.
This is a mostly mechanical change.

In uslcom_param(), move the zeroing of the final two fields of the
flowctrl structure outside of the "if CRTSCTS" section - not only were
they being zeroed in both the clauses, but these two fields have nothing
to do with hardware flow control anyway.
2012-08-14 22:21:46 +00:00
Hans Petter Selasky
65b31289ae Style.
MFC after:	2 weeks
2012-08-10 17:43:20 +00:00
Hans Petter Selasky
1216d2c543 Remove unused structure field.
MFC after:	2 weeks
2012-08-10 17:42:14 +00:00
Hans Petter Selasky
5805d1782d Take advantage of new UCOM and bus functionality so that
the device_detach() function doesn't block on UCOM device
drivers until the TTY handle is closed by the userspace
application. This is implemented by a postpone of the
softc free where the UCOM structures reside until the
TTY references are gone.

Discussed with:	kib, ed
MFC after:	2 weeks
2012-08-10 15:29:41 +00:00
Hans Petter Selasky
8f42c74844 Switch unit management in UCOM to unrhdr.
Extend the callback table of UCOM to include a
"ucom_free" function pointer which is called when
all refs on a UCOM super structure is gone.

Implement various helper functions to handle
refcounting and draining on the UCOM super
structure.

Implement macro which can be used in device
drivers to avoid module unload before all
pending TTY references are gone.

The UCOM API is backwards compatible after this
change and device drivers require no changes
to function with this change. Only a recompilation
of UCOM device drivers is required. The FreeBSD
version has been bumped in that regard.

Discussed with:	kib, ed
MFC after:	2 weeks
2012-08-10 15:21:12 +00:00
Hans Petter Selasky
3426950e9c Update the list of devices supported by the FTDI driver. It might be
that the wrong UART reference clock will be used for a few of the IDs.
It is currently not possible to figure that out because the Linux FTDI
driver detects this run-time and not compile time based on the bcdDevice
field of the USB device descriptor. Some of the ID's in usbdevs are not
sorted according to the product ID value. Please feel free to fix this.
I'm out of my xemacs magic today.

This syncronises us with the linux kernel at kernel.org (HEAD).

MFC after:	2 weeks
2012-08-05 11:50:56 +00:00
Hans Petter Selasky
7a27d904bd Minor style nit:
Use the interface number from the USB interface descriptor
like in the other USB serial drivers. These numbers are not
supposed to be different, though in theory they can. Make sure
that the driver then uses the interface number given by the USB
descriptor, and not the logical index of the USB stack.

For the future:
Whenever the term "index" is used in the USB code, it refers to
a number computed by the USB stack.
Whenever the term "number" is used in the USB code, it refers to
a number in a USB descriptor.

MFC after:	2 weeks
2012-08-05 08:56:29 +00:00
Gavin Atkinson
b5ba3bdb25 Support multiple interface devices. The driver had previously hardcoded
support for only the first port, but the CP2105 can have multiple ports.
Although this allowed the first port to mostly work on multi port devices,
there could be issues with this arrangement.

Update the man page to reflect support for both ports and the CP2105.

Many thanks to Silicon Labs (www.silabs.com) for providing a CP2105-EK
dev board for testing.

MFC after:	2 weeks
2012-08-04 15:11:36 +00:00
Gavin Atkinson
a713d656da Improve descriptions for several devices supported by uslcom(4).
Correct the spelling of the company Telegesis.
Move MpMan to the correct location alphabetically.

MFC after:	2 weeks
2012-07-26 12:18:23 +00:00
Gavin Atkinson
78a1f1400f Add support for more devices to uslcom(4). This commit syncronises the
list of supported devices with the union of:

NetBSD  src/sys/dev/usb/uslsa.c 1.18
OpenBSD src/sys/dev/usb/uslcom.c 1.24
Linux   source/drivers/usb/serial/cp210x.c HEAD

Remove duplicate JABLOTRON PC60B entry.

Note that some of the devices added here are multi-port devices.  The
uslcom(4) driver currently only supports the first port on such devices.

Update the man page to reflect the full list of supported devices.
Remove two caveats from the CAVEATS section, as both listed caveats no
longer apply.  Add a caveat about multi-port devices.

MFC after:	2 weeks
2012-07-26 12:10:19 +00:00
Gavin Atkinson
0ba4723b9e The baud rate on CP1201/2/3 devices can be set in one of two ways:
- The USLCOM_SET_BAUD_DIV command (0x01)
 - The USLCOM_SET_BAUD_RATE command (0x13)

Devices based on the CP1204 will only accept the latter command, and ignore
the former.  As the latter command works on all chips that this driver
supports, switch to always using it.

A slight confusion here is that the previously used command was incorrectly
named USLCOM_BAUD_RATE - even though we no longer use it, rename it to
USLCOM_SET_BAUD_DIV to closer match the name used in the datasheet.

This change reflects a similar change made in the Linux driver, which was
submitted by preston.fick at silabs.com, and has been tested on all of the
uslcom(4) devices I have to hand.

MFC after:	2 weeks
2012-07-25 20:46:22 +00:00
Gavin Atkinson
d01755ed20 Update the list of devices supported by uplcom. Although this only adds
one device (support for Motorola cables), this syncronises us with:

OpenBSD src/sys/dev/usb/uplcom.c 1.56
NetBSD  src/sys/dev/usb/uplcom.c 1.73
Linux   kernel.org HEAD

MFC after:	1 week
2012-07-25 11:33:43 +00:00
Eygene Ryabinkin
411e2f7fc8 u3g: add support for Huawei E392 LTE modem
I am using it rebranded and it carries the label "Megafon"
(it is Russian mobile operator); works fine with my 3G network.

Approved by: hselasky
2012-07-23 14:22:45 +00:00
Hans Petter Selasky
c6b5a9a02b Add new USB device ID.
PR:		usb/169789
Submitted by:	Ruslan Bukin
MFC after:	1 week
2012-07-16 10:12:07 +00:00
Hans Petter Selasky
6446f79981 Add new USB device ID.
PR:		usb/169789
MFC after:	1 week
2012-07-16 09:35:47 +00:00
Hans Petter Selasky
48804d9c0e Add new USB device ID.
PR:		usb/169789
MFC after:	1 week
2012-07-15 18:12:09 +00:00
Hans Petter Selasky
583cd66931 Add new USB device ID.
Submitted by:	Erich Dollansky
MFC after:	1 week
2012-07-03 16:32:47 +00:00
Marius Strobl
f3b44896bb Refine r237102 a bit:
- Anounce JTAG interfaces deliberately skipped.
- Bring back empty lines too eagerly removed.

MFC after:	3 days
2012-06-18 19:18:31 +00:00
Marius Strobl
a589806b07 - Add support for the FT2232 based egnite Turtelizer 2 JTAG/RS232 Adapter.
This includes adding support for skipping FTDI interfaces used for JTAG
  leaving them for userland and just attaching to the RS232 half, similarly
  to how the corresponding Linux drivers handles these kind of adapters.
  While at it, sort uftdi_devs and return BUS_PROBE_SPECIFIC (because
  uftdi_probe() alters the instance variables for better or worse as do
  other probe routines of USB drivers) instead of 0.
- Remove duplicated entries for BeagleBone.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.
- Remove some stray lines.

MFC after:	3 days
2012-06-14 21:16:19 +00:00
Kevin Lo
03167052c4 Add support for the SIMCom SIM5218, tested by me. 2012-04-21 14:30:51 +00:00
Thomas Quinot
4815449e08 Fix typo in comment 2012-04-18 12:50:13 +00:00
Hans Petter Selasky
6d917491f5 Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after:	1 weeks
2012-04-02 10:50:42 +00:00
Hans Petter Selasky
b733be57cc Add new USB device IDs.
PR:		usb/165815
MFC after:	1 week
2012-03-08 07:22:41 +00:00
Hans Petter Selasky
a40c00a535 Add new USB device ID.
MFC after:	3 days
PR:		usb/165154
2012-02-14 21:36:55 +00:00
Stanislav Sedov
f6d505ea58 - Add ID for the BeagleBone FTDI serial over usb port.
MFC after:	3 days
2012-01-16 23:14:23 +00:00
Hans Petter Selasky
36dc69c414 Add support for more USB devices.
Submitted by:	pav @
MFC after:	1 week
2012-01-16 22:26:25 +00:00
Hans Petter Selasky
96d87d2b69 Export ttyname instead of ttyunit via the sysctl interface.
Submitted by:	Mykhaylo Yehorov
PR:		usb/164090
MFC after:	1 week
2012-01-16 10:42:43 +00:00
Hans Petter Selasky
3a4a1a7f8a Export information about USB serial port unit and port numbers
directly via the sysctl interface.

Submitted by:	Mykhaylo Yehorov
PR:		usb/164090
MFC after:	1 week
2012-01-16 08:13:25 +00:00
Tim Kientzle
79ca35f323 BeagleBone uses an FTDI chip with
an altered Product ID.
2012-01-15 23:00:33 +00:00
Ulrich Spörlein
9a14aa017b Convert files to UTF-8 2012-01-15 13:23:18 +00:00
Andriy Gapon
9976156f12 kern cons: introduce infrastructure for console grabbing by kernel
At the moment grab and ungrab methods of all console drivers are no-ops.

Current intended meaning of the calls is that the kernel takes control of
console input.  In the future the semantics may be extended to mean that
the calling thread takes full ownership of the console (e.g. console
output from other threads could be suspended).

Inspired by:	bde
MFC after:	2 months
2011-12-17 15:08:43 +00:00
Hans Petter Selasky
17c78d345c - This patch adds custom IOCTLs to read and write the 4 GPIO pins on the
cp2103 usb-to-serial chip.
- This patch also makes the line status polling asynchronous, to reduce
the time needed to change the GPIO pins.

Submitted by:	JD Louw
MFC after:	1 week
2011-11-12 08:40:52 +00:00
Hans Petter Selasky
271ae033e9 Style change.
- Make it easier to port the USB code to other platforms by only using
one set of memory functions for clearing and copying memory. None of
the memory copies are overlapping. This means using bcopy() is not
required.
- Fix a compile warning when USB_HAVE_BUSDMA=0
- Add missing semicolon in avr32dci.
- Update some comments.

MFC after:	1 week
2011-11-12 08:16:45 +00:00
Hans Petter Selasky
5086c26a6c Some minor corrections to a modem driver.
PR:		usb/162307
MFC after:	3 days
2011-11-09 09:15:57 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Hans Petter Selasky
13ceb65482 Add support for new USB modem protocol.
PR:		usb/159919
MFC after:	1 week
2011-11-06 23:11:30 +00:00
Hans Petter Selasky
0527a869a9 Implement support for modem control lines.
Don't short terminate transmitted BULK data.
Assume that the chip reads one USB packet at a time.

PR:		usb/162307
MFC after:	3 days
2011-11-05 12:01:51 +00:00
Hans Petter Selasky
f6c6639af8 Bugfix: The ucom detach function is sometimes called on zeroed structures.
Check for this case and just return, so that the UCOM unit number zero is
not accidentially freed.

Submitted by:	Danish FreeBSD user at EuroBSDcon 2011
MFC after:	3 days
2011-10-10 15:54:44 +00:00
Hans Petter Selasky
d840e1d248 Add new USB ID to u3g driver.
Approved by:    re (kib)
MFC after:      1 week
PR:		usb/159919
2011-08-20 16:21:40 +00:00
Hans Petter Selasky
14bd1ee52c Add new USB ID to u3g driver.
Approved by:	re (kib)
Submitted by:	Nick Hibma
MFC after:	3 days
2011-07-21 06:55:43 +00:00
Hans Petter Selasky
9cfbe3e76b - Export more USB device ID's.
MFC after:	3 days
2011-06-24 19:32:29 +00:00
Hans Petter Selasky
f1a16106b6 - Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
	host, device or dual mode
- Add generic tool to extract these data:
	tools/bus_autoconf

Discussed with:	imp
Suggested by:	Robert Millan <rmh@debian.org>
PR:		misc/157903
MFC after:	14 days
2011-06-24 02:30:02 +00:00
Hans Petter Selasky
884a2a6996 Rename recently added USB serial driver.
Suggested by:	YongHyeon PYUN
MFC after:	7 days
2011-06-04 20:40:24 +00:00