summaryrefslogtreecommitdiff
path: root/src/revenge_dump_misc.c
blob: f1a8b9018584e3c53774073f13746dbe7f4f1313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * $Id$
 * Copyright (C) 2007  Oliver McFadden <z3ro.geek@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <revenge_detect.h>
#include <revenge_main.h>

void
dump_device_id (void)
{
  FILE *file;

  if (!(file = fopen ("device_id.txt", "w")))
    {
      fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
	       __FILE__, __LINE__, strerror (errno));
      exit (EXIT_FAILURE);
    }

  fprintf (file, "%04x\n", reg_device_id);

  fclose (file);
}

void
dump_device_name (void)
{
  FILE *file;

  if (!(file = fopen ("device_name.txt", "w")))
    {
      fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
	       __FILE__, __LINE__, strerror (errno));
      exit (EXIT_FAILURE);
    }

  fprintf (file, "%s\n", reg_device_name);

  fclose (file);
}

void
dump_fglrx_version (void)
{
  system
    ("fglrxinfo 2> /dev/null | sed -n 's/.*(\\([^)]*\\)).*/\\1/p' > fglrx_version.txt");
}

void
dump_fglrxinfo (void)
{
  system ("fglrxinfo -v 2> /dev/null > fglrxinfo.txt");
}

void
dump_glxinfo (void)
{
  system ("glxinfo -v 2> /dev/null > glxinfo.txt");
}

void
dump_interface (void)
{
  FILE *file;

  if (!(file = fopen ("interface.txt", "w")))
    {
      fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
	       __FILE__, __LINE__, strerror (errno));
      exit (EXIT_FAILURE);
    }

  fprintf (file, "%d\n", option_interface);

  fclose (file);
}

void
dump_lspci (void)
{
  system ("lspci -v 2> /dev/null > lspci.txt");
}