You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
7.4 KiB

  1. --- a/lib/Device/USB.pm
  2. +++ b/lib/Device/USB.pm
  3. @@ -15,6 +15,7 @@ use Inline (
  4. ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ),
  5. NAME => 'Device::USB',
  6. VERSION => '0.37',
  7. + PREFIX => 'deviceusb_',
  8. );
  9. Inline->init();
  10. @@ -540,74 +541,74 @@ unsigned DeviceUSBDebugLevel()
  11. return debugLevel;
  12. }
  13. -void libusb_init()
  14. +void deviceusb_libusb_init()
  15. {
  16. usb_init();
  17. }
  18. -int libusb_find_busses()
  19. +int deviceusb_libusb_find_busses()
  20. {
  21. return usb_find_busses();
  22. }
  23. -int libusb_find_devices()
  24. +int deviceusb_libusb_find_devices()
  25. {
  26. return usb_find_devices();
  27. }
  28. -void *libusb_get_busses()
  29. +void *deviceusb_libusb_get_busses()
  30. {
  31. return usb_get_busses();
  32. }
  33. -void *libusb_open(void *dev)
  34. +void *deviceusb_libusb_open(void *dev)
  35. {
  36. return usb_open( (struct usb_device*)dev );
  37. }
  38. -int libusb_close(void *dev)
  39. +int deviceusb_libusb_close(void *dev)
  40. {
  41. return usb_close((usb_dev_handle *)dev);
  42. }
  43. -int libusb_set_configuration(void *dev, int configuration)
  44. +int deviceusb_libusb_set_configuration(void *dev, int configuration)
  45. {
  46. if(DeviceUSBDebugLevel())
  47. {
  48. - printf( "libusb_set_configuration( %d )\n", configuration );
  49. + printf( "deviceusb_libusb_set_configuration( %d )\n", configuration );
  50. }
  51. return usb_set_configuration((usb_dev_handle *)dev, configuration);
  52. }
  53. -int libusb_set_altinterface(void *dev, int alternate)
  54. +int deviceusb_libusb_set_altinterface(void *dev, int alternate)
  55. {
  56. if(DeviceUSBDebugLevel())
  57. {
  58. - printf( "libusb_set_altinterface( %d )\n", alternate );
  59. + printf( "deviceusb_libusb_set_altinterface( %d )\n", alternate );
  60. }
  61. return usb_set_altinterface((usb_dev_handle *)dev, alternate);
  62. }
  63. -int libusb_clear_halt(void *dev, unsigned int ep)
  64. +int deviceusb_libusb_clear_halt(void *dev, unsigned int ep)
  65. {
  66. if(DeviceUSBDebugLevel())
  67. {
  68. - printf( "libusb_clear_halt( %d )\n", ep );
  69. + printf( "deviceusb_libusb_clear_halt( %d )\n", ep );
  70. }
  71. return usb_clear_halt((usb_dev_handle *)dev, ep);
  72. }
  73. -int libusb_reset(void *dev)
  74. +int deviceusb_libusb_reset(void *dev)
  75. {
  76. return usb_reset((usb_dev_handle *)dev);
  77. }
  78. -int libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen)
  79. +int deviceusb_libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen)
  80. {
  81. int ret = 0;
  82. if(DeviceUSBDebugLevel())
  83. {
  84. - printf( "libusb_get_driver_np( %d )\n", interface );
  85. + printf( "deviceusb_libusb_get_driver_np( %d )\n", interface );
  86. }
  87. #if LIBUSB_HAS_GET_DRIVER_NP
  88. ret = usb_get_driver_np((usb_dev_handle *)dev, interface, name, namelen);
  89. @@ -618,11 +619,11 @@ int libusb_get_driver_np(void *dev, int
  90. #endif
  91. }
  92. -int libusb_detach_kernel_driver_np(void *dev, int interface)
  93. +int deviceusb_libusb_detach_kernel_driver_np(void *dev, int interface)
  94. {
  95. if(DeviceUSBDebugLevel())
  96. {
  97. - printf( "libusb_detach_kernel_driver_np( %d )\n", interface );
  98. + printf( "deviceusb_libusb_detach_kernel_driver_np( %d )\n", interface );
  99. }
  100. #if LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
  101. return usb_detach_kernel_driver_np((usb_dev_handle *)dev, interface);
  102. @@ -631,25 +632,25 @@ int libusb_detach_kernel_driver_np(void
  103. #endif
  104. }
  105. -int libusb_claim_interface(void *dev, int interface)
  106. +int deviceusb_libusb_claim_interface(void *dev, int interface)
  107. {
  108. if(DeviceUSBDebugLevel())
  109. {
  110. - printf( "libusb_claim_interface( %d )\n", interface );
  111. + printf( "deviceusb_libusb_claim_interface( %d )\n", interface );
  112. }
  113. return usb_claim_interface((usb_dev_handle *)dev, interface);
  114. }
  115. -int libusb_release_interface(void *dev, int interface)
  116. +int deviceusb_libusb_release_interface(void *dev, int interface)
  117. {
  118. if(DeviceUSBDebugLevel())
  119. {
  120. - printf( "libusb_release_interface( %d )\n", interface );
  121. + printf( "deviceusb_libusb_release_interface( %d )\n", interface );
  122. }
  123. return usb_release_interface((usb_dev_handle *)dev, interface);
  124. }
  125. -void libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout)
  126. +void deviceusb_libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout)
  127. {
  128. int i = 0;
  129. int retval = 0;
  130. @@ -658,7 +659,7 @@ void libusb_control_msg(void *dev, int r
  131. if(DeviceUSBDebugLevel())
  132. {
  133. - printf( "libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n",
  134. + printf( "deviceusb_libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n",
  135. requesttype, request, value, index, bytes, size, timeout
  136. );
  137. /* maybe need to add support for printing the bytes string. */
  138. @@ -691,54 +692,54 @@ void libusb_control_msg(void *dev, int r
  139. Inline_Stack_Done;
  140. }
  141. -int libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen)
  142. +int deviceusb_libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen)
  143. {
  144. if(DeviceUSBDebugLevel())
  145. {
  146. - printf( "libusb_get_string( %d, %d, %p, %lu )\n",
  147. + printf( "deviceusb_libusb_get_string( %d, %d, %p, %lu )\n",
  148. index, langid, buf, (unsigned long)buflen
  149. );
  150. }
  151. return usb_get_string((usb_dev_handle *)dev, index, langid, buf, buflen);
  152. }
  153. -int libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen)
  154. +int deviceusb_libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen)
  155. {
  156. if(DeviceUSBDebugLevel())
  157. {
  158. - printf( "libusb_get_string_simple( %d, %p, %lu )\n",
  159. + printf( "deviceusb_libusb_get_string_simple( %d, %p, %lu )\n",
  160. index, buf, (unsigned long)buflen
  161. );
  162. }
  163. return usb_get_string_simple((usb_dev_handle *)dev, index, buf, buflen);
  164. }
  165. -int libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size)
  166. +int deviceusb_libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size)
  167. {
  168. return usb_get_descriptor((usb_dev_handle *)dev, type, index, buf, size);
  169. }
  170. -int libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size)
  171. +int deviceusb_libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size)
  172. {
  173. return usb_get_descriptor_by_endpoint((usb_dev_handle *)dev, ep, type, index, buf, size);
  174. }
  175. -int libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout)
  176. +int deviceusb_libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout)
  177. {
  178. return usb_bulk_write((usb_dev_handle *)dev, ep, bytes, size, timeout);
  179. }
  180. -int libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout)
  181. +int deviceusb_libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout)
  182. {
  183. return usb_bulk_read((usb_dev_handle *)dev, ep, bytes, size, timeout);
  184. }
  185. -int libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout)
  186. +int deviceusb_libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout)
  187. {
  188. return usb_interrupt_write((usb_dev_handle *)dev, ep, bytes, size, timeout);
  189. }
  190. -int libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout)
  191. +int deviceusb_libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout)
  192. {
  193. return usb_interrupt_read((usb_dev_handle *)dev, ep, bytes, size, timeout);
  194. }