~ubuntu-branches/ubuntu/trusty/oss4/trusty-proposed

« back to all changes in this revision

Viewing changes to setup/gen_driver_beos.inc

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis, Samuel Thibault, Romain Beauxis, Sebastien NOEL
  • Date: 2011-06-14 10:06:56 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110614100656-cx4oc7u426zn812z
Tags: 4.2-build2004-1
[ Samuel Thibault ]
* debian/control: Add liboss4-salsa2, liboss4-salsa-dev and
  liboss4-salsa-asound2 packages, equivalent to (and will replace) those from
  the oss-libsalsa package (Closes: #589127).
* debian/patches/liboss4-salsa.patch: New patch to rename libsalsa into
  liboss4-salsa to avoid conflicts in the archive for no good reason.
* debian/rules: Make in libOSSlib and libsalsa.
* debian/liboss4-salsa-dev.install, debian/liboss4-salsa2.install,
  debian/liboss4-salsa-asound2.links, debian/liboss4-salsa-dev.links:
  Install liboss4-salsa libraries like was done in the oss-libsalsa package.
* include-alsa: Add a copy of ALSA 1.0.5 headers: Cf ALSA_1.0.* symbols in
  libsalsa, this is the roughly supported version.
* debian/copyright: Update for new include-alsa files.
* alsa.pc: New file for compatibility with libasound-dev.
* debian/control:
  - Add Vcs-Browser and Vcs-Svn fields.
  - Use linux-any instead of the list of Linux archs (Closes: #604679).
  - Make dkms dependency linux-any only.
* debian/patches/hurd_iot.patch: New patch to fix soundcard.h usage in
  libsalsa on hurd-i386.
* debian/patches/libsalsa_fixes.patch: New patch to fix some printf usages
  and ioctl declaration in libsalsa.
* debian/patches/no_EBADE.patch: New patch to cope with hurd-i386 not having
  EBADE.
* debian/patches/CFLAGS.patch: New patch to make oss4 take debian/rules
  CFLAGS into account.
* debian/patches/snd_asoundlib_version.patch: New patch to add
  snd_asoundlib_version().
* debian/patches/generic_srccconf.patch: New patch to fix source
  configuration on unknown archs.

[ Romain Beauxis ]
* Fixed README.Debian to only mention dkms' modules.
* Switch to dpkg-source 3.0 (quilt) format
* Added DM-Upload-Allowed: yes

[ Sebastien NOEL ]
* New upstream release (Closes: #595298, #619272).
* Fix typo in initscript (Closes: #627149).
* debian/control: adjust linux-headers dependencies (Closes: #628879).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
static void
 
2
generate_driver (char *name, conf_t * conf, char *cfg_name, char *cfg_header,
 
3
                 char *dirname, char *topdir)
 
4
{
 
5
 
 
6
  /* BeOS version */
 
7
//XXX:WRITEME
 
8
 
 
9
  FILE *f, *src;
 
10
  char tmp[256], line[256], *p, *s;
 
11
  int i, n = 0;
 
12
  char *options[MAXOPTS];
 
13
  int nopts = 0;
 
14
 
 
15
  sprintf (tmp, "%s/%s", dirname, cfg_name);
 
16
 
 
17
  if ((src = fopen (tmp, "w")) == NULL)
 
18
    {
 
19
      perror (tmp);
 
20
      exit (-1);
 
21
    }
 
22
 
 
23
  fprintf (src, "/*\n");
 
24
  fprintf (src, " * Automatically generated file - do not edit.\n");
 
25
  fprintf (src, " */\n");
 
26
 
 
27
 
 
28
/*
 
29
 * Handle driver specific configuration options
 
30
 */
 
31
  sprintf (tmp, "%s/.params", dirname);
 
32
  if ((f = fopen (tmp, "r")) != NULL)
 
33
    {
 
34
      while (fgets (line, sizeof (line) - 1, f) != NULL)
 
35
        {
 
36
          p = line + strlen (line) - 1;
 
37
          if (*p == '\n')
 
38
            *p = 0;
 
39
 
 
40
          fprintf (src, "%s\n", line);
 
41
          if (strncmp (line, "int ", 4) == 0)
 
42
            {
 
43
              char *s = line + 4, *p = s;
 
44
 
 
45
              while (*p && *p != '=' && *p != ';')
 
46
                p++;
 
47
              *p = 0;
 
48
              if (nopts >= MAXOPTS)
 
49
                {
 
50
                  fprintf (stderr, "Too many options for driver '%s' (%d)\n",
 
51
                           name, nopts);
 
52
                  exit (-1);
 
53
                }
 
54
 
 
55
              options[nopts++] = strdup (s);
 
56
            }
 
57
        }
 
58
 
 
59
      fclose (f);
 
60
    }
 
61
 
 
62
  fprintf (src, "\n");
 
63
  fprintf (src, "#include \"%s\"\n", cfg_header);
 
64
  fprintf (src, "\n");
 
65
 
 
66
  if ((f = fopen ("devices.list", "r")) == NULL)
 
67
    {
 
68
      perror ("devices.list");
 
69
      exit (-1);
 
70
    }
 
71
 
 
72
  if (strcmp (conf->bus, "PCI") == 0)
 
73
    {
 
74
      fprintf (src, "static struct {\n");
 
75
      fprintf (src, "\tbool subsystem;\n");
 
76
      fprintf (src, "\tuint32 vendor, product;\n");
 
77
      fprintf (src, "} id_table[] = {\n");
 
78
 
 
79
      while (fgets (line, sizeof (line) - 1, f) != NULL)
 
80
        {
 
81
          int vendor, product;
 
82
          p = line + strlen (line) - 1;
 
83
          if (*p == '\n')
 
84
            *p = 0;
 
85
 
 
86
          p = line;
 
87
          while (*p && *p != '\t')
 
88
            p++;
 
89
          if (*p == '\t')
 
90
            *p++ = 0;
 
91
 
 
92
          if (strcmp (line, name) != 0)
 
93
            continue;
 
94
 
 
95
          n++;
 
96
 
 
97
          s = p;
 
98
          while (*p && *p != '\t')
 
99
            p++;
 
100
          if (*p == '\t')
 
101
            *p++ = 0;
 
102
 
 
103
          if (strncmp (s, "pci", 3) == 0 || strncmp (s, "pcs", 3) == 0)
 
104
            {
 
105
              const char *sub = (strncmp (s, "pcs", 3) == 0) ? "true" : "false";
 
106
              if (sscanf (s + 3, "%x,%x", &vendor, &product) != 2)
 
107
                {
 
108
                  fprintf (stderr, "Bad PCI id %s\n", s);
 
109
                }
 
110
 
 
111
              fprintf (src, "\t{%s,\t0x%x,\t0x%x},\n", sub, vendor, product);
 
112
            }
 
113
 
 
114
        }
 
115
 
 
116
      fprintf (src, "\t{0}\n");
 
117
      fprintf (src, "};\n");
 
118
      fprintf (src, "\n");
 
119
    }
 
120
 
 
121
  fclose (f);
 
122
 
 
123
 
 
124
/*
 
125
 * Create the driver specific option list
 
126
 */
 
127
  fprintf (src, "static oss_option_map_t local_driver_options[] =\n");
 
128
  fprintf (src, "{\n");
 
129
  for (i = 0; i < nopts; i++)
 
130
    fprintf (src, "\t{\"%s\", &%s},\n", options[i], options[i]);
 
131
  fprintf (src, "\t{NULL, NULL}\n");
 
132
  fprintf (src, "};\n");
 
133
  fprintf (src, "\n");
 
134
 
 
135
  fprintf (src, "#include \"%s/%s/module.inc\"\n", topdir, this_os);
 
136
 
 
137
  if (n == 0)
 
138
    {
 
139
      fprintf (stderr,
 
140
               "Warning: No device entries (devices.list) for driver %s\n",
 
141
               name);
 
142
    }
 
143
 
 
144
  fclose (src);
 
145
 
 
146
  /* config header */
 
147
 
 
148
  sprintf (tmp, "%s/%s", dirname, cfg_header);
 
149
  if ((src = fopen (tmp, "w")) == NULL)
 
150
    {
 
151
      perror (tmp);
 
152
      exit (-1);
 
153
    }
 
154
 
 
155
  fprintf (src, "/*\n");
 
156
  fprintf (src, " * Automatically generated file - do not edit.\n");
 
157
  fprintf (src, " */\n");
 
158
 
 
159
  /* nudge all symbols to function pointers */
 
160
  fprintf (src, "#define BUILDING_DRIVER\n");
 
161
 
 
162
  fprintf (src, "#include <oss_config.h>\n");
 
163
  fprintf (src, "\n");
 
164
 
 
165
  fprintf (src, "#define DRIVER_NAME\t%s\n", name);
 
166
  fprintf (src, "#define DRIVER_NICK\t\"%s\"\n", name);
 
167
  fprintf (src, "#define DRIVER_PURPOSE\t\"%s\"\n", conf->purpose);
 
168
  fprintf (src, "#define DRIVER_STR_INFO\t%s_str_info\n", name);
 
169
  fprintf (src, "#define DRIVER_PROBE\t%s_probe\n", name);
 
170
  fprintf (src, "#define DRIVER_ATTACH\t%s_attach\n", name);
 
171
  fprintf (src, "#define DRIVER_DETACH\t%s_detach\n", name);
 
172
  fprintf (src, "#define DRIVER_TYPE\tDRV_%s\n", conf->bus);
 
173
 
 
174
  fprintf (src, "#define DRIVER_MODULE_OBJECT\tgModule_%s\n", name);
 
175
  fprintf (src, "\n");
 
176
 
 
177
  fprintf (src, "extern int DRIVER_PROBE(void);\n");
 
178
  fprintf (src, "extern int DRIVER_ATTACH(oss_device_t *ossdev);\n");
 
179
  fprintf (src, "extern int DRIVER_DETACH(oss_device_t *ossdev);\n");
 
180
 
 
181
  fclose (src);
 
182
 
 
183
}