PERFORCE change 122895 for review
Rui Paulo
rpaulo at FreeBSD.org
Thu Jul 5 00:51:47 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122895
Change 122895 by rpaulo at rpaulo_epsilon on 2007/07/05 00:51:41
Backout previous.
Affected files ...
.. //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 edit
Differences ...
==== //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#4 $
+ * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 $
*/
#include <sys/cdefs.h>
@@ -71,10 +71,6 @@
static int atp_attach(device_t);
static int atp_detach(device_t);
-static int atp_enable(device_t);
-static int atp_disable(device_t);
-static void atp_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
-
/*
* char device interface.
*/
@@ -97,19 +93,7 @@
struct atp_softc {
device_t sc_dev;
- int sc_enabled;
-
- u_char *sc_ibuf;
- int sc_isize;
- usbd_interface_handle sc_iface; /* interface */
- usbd_pipe_handle sc_intrpipe; /* interrupt pipe */
- int sc_ep_addr;
-
- mousehw_t hw;
- mousemode_t mode;
- mousestatus_t status;
- struct cdev *dev; /* specfs */
};
static device_method_t atp_methods[] = {
@@ -185,116 +169,17 @@
static int
atp_attach(device_t self)
{
- struct atp_softc *sc = device_get_softc(self);
- struct usb_attach_arg *uaa = device_get_ivars(self);
- usbd_interface_handle iface = uaa->iface;
- usb_interface_descriptor_t *id;
- usb_endpoint_descriptor_t *ed;
- usbd_status err;
- int size;
- void *desc;
- uint32_t flags;
-
-
- struct hid_location a;
-
- sc->sc_dev = self;
-
- id = usbd_get_interface_descriptor(iface);
- ed = usbd_interface2endpoint_descriptor(iface, 0);
- if (!ed) {
- printf("%s: could not read endpoint descriptor\n",
- device_get_nameunit(sc->sc_dev));
- return (ENXIO);
- }
-
- if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_IN ||
- UE_GET_XFERTYPE(ed->bmAttributes) != UE_INTERRUPT) {
- printf("%s: unexpected endpoint\n",
- device_get_nameunit(sc->sc_dev));
- return (ENXIO);
- }
-
- err = usbd_read_report_desc(uaa->iface, &desc, &size, M_TEMP);
- if (err)
- return (ENXIO);
-
- hid_locate(desc, size, 1, hid_input, &a, &flags);
-
- /* Equal to ums(4). */
- sc->hw.iftype = MOUSE_IF_USB;
- sc->hw.type = MOUSE_MOUSE;
- sc->hw.model = MOUSE_MODEL_GENERIC;
- sc->hw.hwid = 0;
- sc->mode.protocol = MOUSE_PROTO_MSC;
- sc->mode.rate = -1;
- sc->mode.resolution = MOUSE_RES_UNKNOWN;
- sc->mode.accelfactor = 0;
- sc->mode.level = 0;
- sc->mode.packetsize = MOUSE_MSC_PACKETSIZE;
- sc->mode.syncmask[0] = MOUSE_MSC_SYNCMASK;
- sc->mode.syncmask[1] = MOUSE_MSC_SYNC;
-
- sc->dev = make_dev(&atp_cdevsw, device_get_unit(self),
- UID_ROOT, GID_OPERATOR,
- 0644, "atp%d", device_get_unit(self));
-
-
return 0;
}
static int
atp_detach(device_t self)
{
- struct atp_softc *sc = device_get_softc(self);
- destroy_dev(sc->dev);
-
return 0;
}
-static void
-atp_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
-{
-
-
-}
-
-static int
-atp_enable(device_t self)
-{
- struct atp_softc *sc = device_get_softc(self);
- usbd_status err;
-
- sc->sc_enabled = 1;
-
- err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr,
- USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc,
- sc->sc_ibuf, sc->sc_isize, atp_intr,
- USBD_DEFAULT_INTERVAL);
- if (err) {
- device_printf(self, "usb_open_pipe_intr failed with error=%d\n",
- err);
- sc->sc_enabled = 0;
- return (EIO);
- }
-
- return (0);
-}
-
-static int
-atp_disable(device_t self)
-{
- struct atp_softc *sc = device_get_softc(self);
-
- /* Disable interrupts. */
- usbd_abort_pipe(sc->sc_intrpipe);
- usbd_close_pipe(sc->sc_intrpipe);
-
- sc->sc_enabled = 0;
-}
-
static int
atp_open(struct cdev *dev, int flag, int fmt, struct thread *p)
{
More information about the p4-projects
mailing list