driver-bitfury.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2013 Con Kolivas
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation; either version 3 of the License, or (at your option)
  7. * any later version. See COPYING for more details.
  8. */
  9. #include "config.h"
  10. #include "miner.h"
  11. #include "driver-bitfury.h"
  12. struct device_drv bitfury_drv;
  13. static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
  14. {
  15. struct cgpu_info *bitfury;
  16. bitfury = usb_alloc_cgpu(&bitfury_drv, 1);
  17. if (!usb_init(bitfury, dev, found)) {
  18. bitfury = usb_free_cgpu(bitfury);
  19. return false;
  20. }
  21. applog(LOG_WARNING, "%s%d: Found at %s", bitfury->drv->name,
  22. bitfury->device_id, bitfury->device_path);
  23. return true;
  24. }
  25. static void bitfury_detect(void)
  26. {
  27. usb_detect(&bitfury_drv, bitfury_detect_one);
  28. }
  29. static bool bitfury_prepare(struct thr_info __maybe_unused *thr)
  30. {
  31. return false;
  32. }
  33. static bool bitfury_fill(struct cgpu_info __maybe_unused *bitfury)
  34. {
  35. return true;
  36. }
  37. static int64_t bitfury_scanhash(struct thr_info __maybe_unused *thr)
  38. {
  39. return 0;
  40. }
  41. static void bitfury_flush_work(struct cgpu_info __maybe_unused *bitfury)
  42. {
  43. }
  44. static struct api_data *bitfury_api_stats(struct cgpu_info __maybe_unused *cgpu)
  45. {
  46. return NULL;
  47. }
  48. static void get_bitfury_statline_before(char __maybe_unused *buf, size_t __maybe_unused bufsiz,
  49. struct cgpu_info __maybe_unused *bitfury)
  50. {
  51. }
  52. static void bitfury_init(struct cgpu_info __maybe_unused *bitfury)
  53. {
  54. }
  55. static void bitfury_shutdown(struct thr_info __maybe_unused *thr)
  56. {
  57. }
  58. /* Currently hardcoded to BF1 devices */
  59. struct device_drv bitfury_drv = {
  60. .drv_id = DRIVER_BITFURY,
  61. .dname = "bitfury",
  62. .name = "BFO",
  63. .drv_detect = bitfury_detect,
  64. .thread_prepare = bitfury_prepare,
  65. .hash_work = hash_queued_work,
  66. .queue_full = bitfury_fill,
  67. .scanwork = bitfury_scanhash,
  68. .flush_work = bitfury_flush_work,
  69. .get_api_stats = bitfury_api_stats,
  70. .get_statline_before = get_bitfury_statline_before,
  71. .reinit_device = bitfury_init,
  72. .thread_shutdown = bitfury_shutdown
  73. };