2
0

usb_desc.conf 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. byte(0x04)), # Supports SEND_BREAK
  44. usb_desc('cs_interface.union',
  45. byte(\$mgmt_if), # Controlling interface
  46. byte(\$data_if)), # Data interface
  47. # Notification endpoint (input)
  48. usb_desc('endpoint',
  49. ep_i($ep_intr),
  50. byte(3), # Interrupt, data
  51. word(64), # Max packet size
  52. byte(2)), # Interval
  53. },
  54. # Data interface
  55. usb_dset {
  56. usb_desc('interface',
  57. byte($data_if = usb_index),
  58. byte(0), # No alternate settings
  59. byte(2), # Endpoint count
  60. usb_class('cdc_data'),
  61. usb_string()),
  62. # Data endpoint (input)
  63. usb_desc('endpoint',
  64. ep_i($ep_data),
  65. byte(2), # Bulk, data
  66. word(64), # Max packet size
  67. byte(0)), # Interval
  68. # Data endpoint (output)
  69. usb_desc('endpoint',
  70. ep_o($ep_data),
  71. byte(2), # Bulk, data
  72. word(64), # Max packet size
  73. byte(0)) # Interval
  74. });
  75. }
  76. return @d;
  77. }
  78. usb_device {
  79. usb_desc('device',
  80. word(0x101), # USB version
  81. usb_class('multi'), # Device with multiple interfaces
  82. byte(8), # Max packet size on endpoint 0
  83. $vendor_id, $device_id, $version_id,
  84. $manufacturer, $product, $serial,
  85. byte(usb_children) # Number of configurations
  86. ),
  87. usb_dset {
  88. usb_desc('configuration',
  89. word(usb_totallen), # Total length for this dset
  90. byte(usb_children), # Number of interfaces
  91. byte(usb_index,1), # This configuration index
  92. usb_string(), # Text description (empty)
  93. byte(0xc0), # Self or bus powered
  94. byte(500 >> 1)), # Up to 500 mA
  95. # Descriptors for each ACM channel, starting at endpoint 1
  96. acm_channels($consts{'TTY_CHANNELS'},1)
  97. },
  98. };
  99. usb_additional_data {
  100. # Line state structure
  101. dword(38400), # Baud rate (largest POSIX required value)
  102. byte(0), # 1 stop bit
  103. byte(0), # No parity
  104. byte(8) # 8 data bits
  105. };