Lines Matching refs:device

88 static	void usb_free_all_configs(usb_device_t *device);
90 static void usb_free_config(usb_device_t *device, uint_t index);
93 static void usb_free_interface(usb_device_t *device, uint_t index,
97 static void usb_free_alternate(usb_device_t *device, uint_t index,
276 /* the device must have been hot removed */
314 return ((hdl != NULL) ? hdl->device : NULL);
319 * opens the device for access
321 * Returns: a usb device handle or NULL
345 hdl->device = dev;
377 usb_free_all_configs(hdl->device);
396 * closes the device and free resources
730 * device. Typically there aren't many - often only one. The
824 * switches to the alternate interface for the device
867 dev_specific = (usb_device_specific_t *)(hdl->device->dev);
883 for (index = 0; index < hdl->device->descriptor.bNumConfigurations;
886 hdl->device->config[index].bConfigurationValue) {
894 hdl->device->config[index].interface[iface].num_altsetting);
896 if ((alt < 0) || (alt >= hdl->device->
911 * sets the configuration for the device.
937 for (index = 0; index < hdl->device->descriptor.bNumConfigurations;
940 hdl->device->config[index].bConfigurationValue) {
945 if (index >= hdl->device->descriptor.bNumConfigurations) {
1042 dev_specific = (usb_device_specific_t *)(hdl->device->dev);
1052 index < hdl->device->descriptor.bNumConfigurations;
1055 hdl->device->config[index].bConfigurationValue) {
1061 hdl->device->config[index].bConfigurationValue;
1069 (interface >= hdl->device->config[index].bNumInterfaces)) {
1127 dev_specific = (usb_device_specific_t *)(hdl->device->dev);
1165 * resets the device
1249 * status of the device if error or short xfer.
1347 if_descr = &hdl->device->config[index].interface[interface].
1355 ep_descr = &hdl->device->config[index].interface[interface].
1371 * Make sure that the endpoint and status device for the endpoint
1449 hdl->device->bus->dirname, hdl->device->filename,
1468 /* open the status device node for the ep first RDWR */
1554 (usb_device_specific_t *)(hdl->device->dev);
1576 hdl->device->bus->dirname, hdl->device->filename);
1590 hdl->device->bus->dirname, hdl->device->filename);
1621 (usb_device_specific_t *)(hdl->device->dev);
1683 if (hdl->device->config) {
1690 /* get device descriptor */
1703 /* parse device descriptor */
1705 (struct usb_device_descriptor *)&hdl->device->descriptor,
1717 hdl->device->descriptor.bNumConfigurations;
1719 if ((hdl->device->config = calloc(len, 1)) == NULL) {
1725 for (index = 0; index < hdl->device->descriptor.bNumConfigurations;
1792 (usb_cfg_descr_t *)&hdl->device->config[index],
1805 hdl->device->config[index].bLength,
1806 hdl->device->config[index].bDescriptorType,
1807 hdl->device->config[index].wTotalLength,
1808 hdl->device->config[index].bNumInterfaces,
1809 hdl->device->config[index].bConfigurationValue);
1811 if ((cloud = malloc(hdl->device->config[index].wTotalLength)) ==
1822 hdl->device->config[index].wTotalLength, 0);
1824 if (rval != hdl->device->config[index].wTotalLength) {
1832 hdl->device->config[index].wTotalLength,
1833 (usb_cfg_descr_t *)&hdl->device->config[index],
1842 if ((hdl->device->config[index].extra =
1849 (void) memcpy(hdl->device->config[index].extra, extra,
1851 hdl->device->config[index].extralen = extralen;
1855 len = hdl->device->config[index].bNumInterfaces *
1857 if ((hdl->device->config[index].interface = calloc(len, 1)) ==
1864 for (iface = 0; iface < hdl->device->config[index].bNumInterfaces;
1883 usb_free_config(usb_device_t *device, uint_t index)
1890 if (device->config[index].interface) {
1891 for (iface = 0; iface < device->config[index].bNumInterfaces;
1893 usb_free_interface(device, index, iface);
1895 if (device->config[index].extralen) {
1896 free(device->config[index].extra);
1898 free(device->config[index].interface);
1924 hdl->device->config[index].wTotalLength,
1944 if ((hdl->device->config[index].interface[iface].altsetting =
1949 hdl->device->config[index].interface[iface].num_altsetting =
1969 usb_free_interface(usb_device_t *device, uint_t index, uint_t iface)
1976 if (device->config[index].interface[iface].altsetting) {
1977 max_alt = device->config[index].interface[iface].
1980 usb_free_alternate(device, index, iface, alt);
1982 free(device->config[index].interface[iface].altsetting);
2006 hdl->device->config[index].wTotalLength,
2030 &hdl->device->config[index].interface[iface].altsetting[alt],
2039 if ((hdl->device->config[index].interface[iface].
2045 hdl->device->config[index].interface[iface].
2047 hdl->device->config[index].interface[iface].
2059 if ((hdl->device->config[index].interface[iface].altsetting[alt].
2082 usb_free_alternate(usb_device_t *device, uint_t index, uint_t iface,
2088 if (device->config[index].interface[iface].altsetting[alt].
2092 &device->config[index].
2101 if (device->config[index].interface[iface].altsetting[alt].
2103 free(device->config[index].interface[iface].
2106 free(device->config[index].interface[iface].altsetting[alt].
2131 hdl->device->config[index].wTotalLength,
2148 (void) memcpy(&hdl->device->
2158 if ((hdl->device->config[index].interface[iface].
2164 (void) memcpy(hdl->device->config[index].interface[iface].
2166 hdl->device->config[index].interface[iface].
2243 * frees all configs and then the device structure itself
2257 * gets status of device
2270 usb_error_str(errno, "Could not read device status: %d",
2312 char *device, *filename;
2319 if ((device = malloc(PATH_MAX+1)) == NULL) {
2325 free(device);
2331 free(device);
2356 (void) snprintf(device, PATH_MAX, "%s/%s", bus->dirname,
2363 if (lstat(device, &statbuf) == -1) {
2370 if (regexec(&regex, device, 0, NULL, 0) != 0) {
2374 usb_dprintf(DEBUG_FUNCTIONS, "checking %s\n", device);
2377 if (!(subdir = opendir(device))) {
2391 free(device);
2401 free(device);
2416 /* See if the device is online */
2451 free(device);
2734 * parse device descriptor