Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hid/bcm5974.c
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | static const struct hid_device_id bcm5974_devs[] = { | ||||
BCM5974_DEV(APPLE, WELLSPRING9_JIS, BCM5974_FLAG_WELLSPRING9), | BCM5974_DEV(APPLE, WELLSPRING9_JIS, BCM5974_FLAG_WELLSPRING9), | ||||
}; | }; | ||||
struct bcm5974_softc { | struct bcm5974_softc { | ||||
device_t sc_dev; | device_t sc_dev; | ||||
struct evdev_dev *sc_evdev; | struct evdev_dev *sc_evdev; | ||||
/* device configuration */ | /* device configuration */ | ||||
const struct bcm5974_dev_params *sc_params; | const struct bcm5974_dev_params *sc_params; | ||||
bool sc_saved_mode; | |||||
}; | }; | ||||
static const uint8_t bcm5974_rdesc[] = { | static const uint8_t bcm5974_rdesc[] = { | ||||
0x05, BCM5974_TLC_PAGE, /* Usage Page (BCM5974_TLC_PAGE) */ | 0x05, BCM5974_TLC_PAGE, /* Usage Page (BCM5974_TLC_PAGE) */ | ||||
0x09, BCM5974_TLC_USAGE,/* Usage (BCM5974_TLC_USAGE) */ | 0x09, BCM5974_TLC_USAGE,/* Usage (BCM5974_TLC_USAGE) */ | ||||
0xA1, 0x01, /* Collection (Application) */ | 0xA1, 0x01, /* Collection (Application) */ | ||||
0x06, 0x00, 0xFF, /* Usage Page (Vendor Defined 0xFF00) */ | 0x06, 0x00, 0xFF, /* Usage Page (Vendor Defined 0xFF00) */ | ||||
0x09, 0x01, /* Usage (0x01) */ | 0x09, 0x01, /* Usage (0x01) */ | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | case TYPE3: /* Type 3 does not require a mode switch */ | ||||
break; | break; | ||||
case TYPE4: | case TYPE4: | ||||
err = bcm5974_set_device_mode_hid(sc, on); | err = bcm5974_set_device_mode_hid(sc, on); | ||||
break; | break; | ||||
default: | default: | ||||
KASSERT(0 == 1, ("Unknown trackpad type")); | KASSERT(0 == 1, ("Unknown trackpad type")); | ||||
} | } | ||||
if (!err) | |||||
sc->sc_saved_mode = on; | |||||
return (err); | return (err); | ||||
} | } | ||||
static void | static void | ||||
bcm5974_identify(driver_t *driver, device_t parent) | bcm5974_identify(driver_t *driver, device_t parent) | ||||
{ | { | ||||
void *d_ptr; | void *d_ptr; | ||||
hid_size_t d_len; | hid_size_t d_len; | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct bcm5974_softc *sc = device_get_softc(dev); | struct bcm5974_softc *sc = device_get_softc(dev); | ||||
evdev_free(sc->sc_evdev); | evdev_free(sc->sc_evdev); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | |||||
bcm5974_resume(device_t dev) | |||||
{ | |||||
struct bcm5974_softc *sc = device_get_softc(dev); | |||||
bcm5974_set_device_mode(sc, sc->sc_saved_mode); | |||||
return (0); | |||||
} | |||||
static void | static void | ||||
bcm5974_intr(void *context, void *data, hid_size_t len) | bcm5974_intr(void *context, void *data, hid_size_t len) | ||||
{ | { | ||||
struct bcm5974_softc *sc = context; | struct bcm5974_softc *sc = context; | ||||
const struct bcm5974_dev_params *params = sc->sc_params; | const struct bcm5974_dev_params *params = sc->sc_params; | ||||
union evdev_mt_slot slot_data; | union evdev_mt_slot slot_data; | ||||
struct tp_finger *f; | struct tp_finger *f; | ||||
int ntouch; /* the finger number in touch */ | int ntouch; /* the finger number in touch */ | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static device_method_t bcm5974_methods[] = { | static device_method_t bcm5974_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_identify, bcm5974_identify), | DEVMETHOD(device_identify, bcm5974_identify), | ||||
DEVMETHOD(device_probe, bcm5974_probe), | DEVMETHOD(device_probe, bcm5974_probe), | ||||
DEVMETHOD(device_attach, bcm5974_attach), | DEVMETHOD(device_attach, bcm5974_attach), | ||||
DEVMETHOD(device_detach, bcm5974_detach), | DEVMETHOD(device_detach, bcm5974_detach), | ||||
DEVMETHOD(device_resume, bcm5974_resume), | |||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t bcm5974_driver = { | static driver_t bcm5974_driver = { | ||||
.name = "bcm5974", | .name = "bcm5974", | ||||
.methods = bcm5974_methods, | .methods = bcm5974_methods, | ||||
.size = sizeof(struct bcm5974_softc) | .size = sizeof(struct bcm5974_softc) | ||||
}; | }; | ||||
Show All 9 Lines |