1/* $FreeBSD: head/lib/libusb20/libusb20_ugen20.c 188622 2009-02-14 23:20:00Z thompsa $ */ |
2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 43 unchanged lines hidden (view full) --- 53static libusb20_bus_set_owner_t ugen20_bus_set_owner; 54static libusb20_bus_get_owner_t ugen20_bus_get_owner; 55static libusb20_bus_set_perm_t ugen20_bus_set_perm; 56static libusb20_bus_get_perm_t ugen20_bus_get_perm; 57static libusb20_dev_get_iface_owner_t ugen20_dev_get_iface_owner; 58static libusb20_dev_get_iface_perm_t ugen20_dev_get_iface_perm; 59static libusb20_dev_get_owner_t ugen20_dev_get_owner; 60static libusb20_dev_get_perm_t ugen20_dev_get_perm; |
61static libusb20_dev_get_iface_desc_t ugen20_dev_get_iface_desc; 62static libusb20_dev_get_info_t ugen20_dev_get_info; |
63static libusb20_dev_set_iface_owner_t ugen20_dev_set_iface_owner; 64static libusb20_dev_set_iface_perm_t ugen20_dev_set_iface_perm; 65static libusb20_dev_set_owner_t ugen20_dev_set_owner; 66static libusb20_dev_set_perm_t ugen20_dev_set_perm; 67static libusb20_root_get_dev_quirk_t ugen20_root_get_dev_quirk; 68static libusb20_root_get_quirk_name_t ugen20_root_get_quirk_name; 69static libusb20_root_add_dev_quirk_t ugen20_root_add_dev_quirk; 70static libusb20_root_remove_dev_quirk_t ugen20_root_remove_dev_quirk; --- 880 unchanged lines hidden (view full) --- 951ugen20_bus_get_perm(struct libusb20_backend *pbe, 952 uint8_t bus, mode_t *mode) 953{ 954 return (ugen20_be_do_perm(USB_GET_BUS_PERM, 0, 955 bus, 0, 0, NULL, NULL, mode)); 956} 957 958static int |
959ugen20_dev_get_iface_desc(struct libusb20_device *pdev, 960 uint8_t iface_index, char *buf, uint8_t len) 961{ 962 struct usb2_gen_descriptor ugd; 963 964 memset(&ugd, 0, sizeof(ugd)); 965 966 ugd.ugd_data = buf; 967 ugd.ugd_maxlen = len; 968 ugd.ugd_iface_index = iface_index; 969 970 if (ioctl(pdev->file, USB_GET_IFACE_DRIVER, &ugd)) { 971 return (LIBUSB20_ERROR_INVALID_PARAM); 972 } 973 return (0); 974} 975 976static int 977ugen20_dev_get_info(struct libusb20_device *pdev, 978 struct usb2_device_info *pinfo) 979{ 980 if (ioctl(pdev->file, USB_GET_DEVICEINFO, pinfo)) { 981 return (LIBUSB20_ERROR_INVALID_PARAM); 982 } 983 return (0); 984} 985 986static int |
987ugen20_dev_get_iface_owner(struct libusb20_device *pdev, 988 uint8_t iface_index, uid_t *user, gid_t *group) 989{ 990 return (ugen20_be_do_perm(USB_GET_IFACE_PERM, 0, 991 pdev->bus_number, pdev->device_address, iface_index, 992 user, group, NULL)); 993} 994 --- 187 unchanged lines hidden --- |