2
0

usb_desc.conf 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # -*- perl -*-
  2. #
  3. # Invoked from usbdescgen.pl
  4. #
  5. require '../../iodevs.conf';
  6. usb_languages('en_US', 'sv_SE');
  7. my $vendor_id = word(0x1d50);
  8. my $device_id = word(0x6149);
  9. my $version_id = word(0x0100);
  10. my $serial = usb_serial('_Serial_???_');
  11. my $manufacturer = usb_string('' => 'Peter & Per');
  12. my $product = usb_string('' => 'MAX80 I/O card for ABC');
  13. sub acm_channels($$) {
  14. my($channel_count,$ep_base) = @_;
  15. my @d;
  16. for (my $c = 0; $c < $channel_count; $c++) {
  17. my $ep_data = $ep_base + ($c << 1);
  18. my $ep_intr = $ep_data + 1;
  19. my $mgmt_if;
  20. my $data_if;
  21. push(@d,
  22. # Interface association descriptor
  23. usb_desc('interface_association',
  24. byte(\$mgmt_if), # First interface index
  25. byte(2), # Interface count
  26. # USB spec says to copy the first interface class
  27. usb_class('cdc','acm','v25ter'),
  28. usb_string()),
  29. # Management interface
  30. usb_dset {
  31. usb_desc('interface',
  32. byte($mgmt_if = usb_index),
  33. byte(0), # No alternate settings
  34. byte(1), # Endpoint count
  35. usb_class('cdc','acm','v25ter'),
  36. usb_string()),
  37. usb_desc('cs_interface.header',
  38. word(0x120)), # CDC spec version 1.20
  39. usb_desc('cs_interface.call_management',
  40. byte(0x03), # AT commands over setup or data
  41. byte(\$data_if)), # Which data interface
  42. usb_desc('cs_interface.acm',
  43. # Supports SET_CONTROL_LINE_STATE and
  44. # SEND_BREAK. This also means
  45. # GET|SET_LINE_CODING has to be handled,
  46. # at least vacuously.
  47. byte(0x06)),
  48. usb_desc('cs_interface.union',
  49. byte(\$mgmt_if), # Controlling interface
  50. byte(\$data_if)), # Data interface
  51. # Notification endpoint (input)
  52. usb_desc('endpoint',
  53. ep_i($ep_intr),
  54. byte(3), # Interrupt, data
  55. word(64), # Max packet size
  56. byte(2)), # Interval
  57. },
  58. # Data interface
  59. usb_dset {
  60. usb_desc('interface',
  61. byte($data_if = usb_index),
  62. byte(0), # No alternate settings
  63. byte(2), # Endpoint count
  64. usb_class('cdc_data'),
  65. usb_string()),
  66. # Data endpoint (input)
  67. usb_desc('endpoint',
  68. ep_i($ep_data),
  69. byte(2), # Bulk, data
  70. word(64), # Max packet size
  71. byte(0)), # Interval
  72. # Data endpoint (output)
  73. usb_desc('endpoint',
  74. ep_o($ep_data),
  75. byte(2), # Bulk, data
  76. word(64), # Max packet size
  77. byte(0)) # Interval
  78. });
  79. }
  80. return @d;
  81. }
  82. usb_device {
  83. usb_desc('device',
  84. word(0x101), # USB version
  85. usb_class('multi'), # Device with multiple interfaces
  86. byte(8), # Max packet size on endpoint 0
  87. $vendor_id, $device_id, $version_id,
  88. $manufacturer, $product, $serial,
  89. byte(usb_children) # Number of configurations
  90. ),
  91. usb_dset {
  92. usb_desc('configuration',
  93. word(usb_totallen), # Total length for this dset
  94. byte(usb_children), # Number of interfaces
  95. byte(usb_index,1), # This configuration index
  96. usb_string(), # Text description (empty)
  97. byte(0xc0), # Self or bus powered
  98. byte(500 >> 1)), # Up to 500 mA
  99. # Descriptors for each ACM channel, starting at endpoint 1
  100. acm_channels($consts{'TTY_CHANNELS'},1)
  101. },
  102. };
  103. usb_additional_data {
  104. # Line state structure
  105. dword(38400), # Baud rate (largest POSIX required value)
  106. byte(0), # 1 stop bit
  107. byte(0), # No parity
  108. byte(8) # 8 data bits
  109. };