Changeset 9d1488d in mainline
- Timestamp:
- 2011-11-25T22:29:54Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be51d73
- Parents:
- 10f2b34
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mixerctl/mixerctl.c
r10f2b34 r9d1488d 33 33 */ 34 34 35 #include <assert.h> 35 36 #include <errno.h> 36 37 #include <str_error.h> … … 41 42 #define DEFAULT_DEVICE "/hw/pci0/00:01.0/sb16/mixer" 42 43 43 int main(int argc, char *argv[])44 static void print_levels(async_exch_t *exch) 44 45 { 45 devman_handle_t mixer_handle;46 int ret = devman_fun_get_handle(DEFAULT_DEVICE, &mixer_handle, 0);47 if (ret != EOK) {48 printf("Failed to get device(%s) handle: %s.\n",49 DEFAULT_DEVICE, str_error(ret));50 return 1;51 }52 53 async_sess_t *session = devman_device_connect(54 EXCHANGE_ATOMIC, mixer_handle, IPC_FLAG_BLOCKING);55 if (!session) {56 printf("Failed to connect to device.\n");57 return 1;58 }59 60 async_exch_t *exch = async_exchange_begin(session);61 if (!exch) {62 printf("Failed to start session exchange.\n");63 async_hangup(session);64 return 1;65 }66 67 46 const char* name = NULL; 68 47 unsigned count = 0; 69 ret = audio_mixer_get_info(exch, &name, &count);48 int ret = audio_mixer_get_info(exch, &name, &count); 70 49 if (ret != EOK) { 71 50 printf("Failed to get mixer info: %s.\n", str_error(ret)); 72 return 1;51 return; 73 52 } 74 printf("MIXER : %s.\n", name);53 printf("MIXER %s:\n", name); 75 54 76 55 for (unsigned i = 0; i < count; ++i) { … … 108 87 } 109 88 110 printf(" Channel(%u/%u) %s %s volume: %u/%u%s.\n",89 printf("\tChannel(%u/%u) %s %s volume: %u/%u%s.\n", 111 90 i, j, name, chan, level, max, mute ? " (M)":""); 91 free(chan); 112 92 } 93 free(name); 113 94 114 95 } 96 } 115 97 98 int main(int argc, char *argv[]) 99 { 100 101 const char *device = DEFAULT_DEVICE; 102 if (argc == 2) 103 device = argv[1]; 104 105 106 devman_handle_t mixer_handle; 107 int ret = devman_fun_get_handle(device, &mixer_handle, 0); 108 if (ret != EOK) { 109 printf("Failed to get device(%s) handle: %s.\n", 110 DEFAULT_DEVICE, str_error(ret)); 111 return 1; 112 } 113 114 async_sess_t *session = devman_device_connect( 115 EXCHANGE_ATOMIC, mixer_handle, IPC_FLAG_BLOCKING); 116 if (!session) { 117 printf("Failed to connect to device.\n"); 118 return 1; 119 } 120 121 async_exch_t *exch = async_exchange_begin(session); 122 if (!exch) { 123 printf("Failed to start session exchange.\n"); 124 async_hangup(session); 125 return 1; 126 } 127 128 print_levels(exch); 116 129 117 130 async_exchange_end(exch);
Note:
See TracChangeset
for help on using the changeset viewer.