bool RTIMUMagCal::magCalSaveCorr(const char *ellipsoidFitPath) { FILE *file; char *corrFile; float a[3]; float b[9]; if (ellipsoidFitPath != NULL) { corrFile = (char *)malloc(strlen(RTIMUCALDEFS_MAG_CORR_FILE) + strlen(ellipsoidFitPath) + 2); sprintf(corrFile, "%s/%s", ellipsoidFitPath, RTIMUCALDEFS_MAG_CORR_FILE); if ((file = fopen(corrFile, "r")) == NULL) { HAL_ERROR("Failed to open ellipsoid fit correction data file\n"); return false; } if (fscanf(file, "%f %f %f %f %f %f %f %f %f %f %f %f", a + 0, a + 1, a + 2, b + 0, b + 1, b + 2, b + 3, b + 4, b + 5, b + 6, b + 7, b + 8) != 12) { HAL_ERROR("Ellipsoid corrcetion file didn't have 12 floats\n"); fclose(file); return false; } fclose(file); m_settings->m_compassCalEllipsoidValid = true; m_settings->m_compassCalEllipsoidOffset = RTVector3(a[0], a[1], a[2]); memcpy(m_settings->m_compassCalEllipsoidCorr, b, 9 * sizeof(float)); m_settings->saveSettings(); return true; } return false; }
int main (int argc, char *argv[]) { int fd; int ret; char *device_file; char name[256]; struct floppy_drive_struct ds; fd = -1; /* assume failure */ ret = 1; if (getenv ("UDI") == NULL) goto out; if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL) goto out; setup_logger (); HAL_DEBUG (("Checking if %s is actually present", device_file)); /* Check that there actually is a drive at the other end */ fd = open (device_file, O_RDONLY | O_NONBLOCK); if (fd < 0) { HAL_ERROR (("Could not open %s", device_file)); goto out; } /* @todo Could use the name here */ ioctl (fd, FDRESET, NULL); if (ioctl (fd, FDGETDRVTYP, name) != 0) { HAL_ERROR (("FDGETDRVTYP failed for %s", device_file)); goto out; } HAL_DEBUG (("floppy drive name is '%s'", name)); if (ioctl (fd, FDPOLLDRVSTAT, &ds)) { HAL_ERROR (("FDPOLLDRVSTAT failed for %s", device_file)); goto out; } if (ds.track < 0) { HAL_ERROR (("floppy drive %s seems not to exist", device_file)); goto out; } /* works */ ret = 0; out: if (fd >= 0) close (fd); return ret; }
static void hotplug_event_begin_devfs_add (HotplugEvent *hotplug_event, HalDevice *d) { HalDevice *parent; const gchar *parent_udi; void (*begin_add_func) (HalDevice *, HalDevice *, DevinfoDevHandler *, void *); if (d != NULL) { /* XXX */ HAL_ERROR (("devpath %s already present in store, ignore event", hotplug_event->un.devfs.devfs_path)); goto out; } /* find parent */ parent_udi = hal_device_property_get_string (hotplug_event->d, "info.parent"); if (parent_udi == NULL || strlen(parent_udi) == 0) { parent = NULL; } else { parent = hal_device_store_match_key_value_string (hald_get_gdl (), "info.udi", parent_udi); } /* only root node is allowed to be orphan */ if (parent == NULL) { if (strcmp(hotplug_event->un.devfs.devfs_path, "/") != 0) { HAL_ERROR (("Parent is NULL devfs_path=%s parent_udi=%s", hotplug_event->un.devfs.devfs_path, parent_udi ? parent_udi : "<null>")); goto out; } } /* children of ignored parent should be ignored */ if (parent != NULL && hal_device_property_get_bool (parent, "info.ignore")) { HAL_INFO (("parent ignored %s", parent_udi)); goto out; } /* custom or generic add function */ begin_add_func = hotplug_event->un.devfs.handler->hotplug_begin_add; if (begin_add_func == NULL) { begin_add_func = hotplug_event_begin_add_devinfo; } begin_add_func (hotplug_event->d, parent, hotplug_event->un.devfs.handler, (void *) hotplug_event); return; out: g_object_unref (hotplug_event->d); hotplug_event_end ((void *) hotplug_event); return; }
static gboolean add_command(DBusMessageIter *iter, const gchar *command_line) { gint argc; gint x; char **argv; GError *err = NULL; DBusMessageIter array_iter; if (!g_shell_parse_argv(command_line, &argc, &argv, &err)) { HAL_ERROR (("Error parsing commandline '%s': %s", command_line, err->message)); g_error_free (err); return FALSE; } if (!dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter)) DIE (("No memory")); for (x = 0 ; argv[x] != NULL; x++) { dbus_message_iter_append_basic(&array_iter, DBUS_TYPE_STRING, &argv[x]); } dbus_message_iter_close_container(iter, &array_iter); g_strfreev(argv); return TRUE; }
void hal_device_store_add (HalDeviceStore *store, HalDevice *device) { const char buf[] = "/org/freedesktop/Hal/devices/"; if (strncmp(hal_device_get_udi (device), buf, sizeof (buf) - 1) != 0) { HAL_ERROR(("Can't add HalDevice with incorrect UDI. Valid " "UDI must start with '/org/freedesktop/Hal/devices/'")); goto out; } store->devices = g_slist_prepend (store->devices, g_object_ref (device)); g_signal_connect (device, "property_changed", G_CALLBACK (emit_device_property_changed), store); g_signal_connect (device, "pre_property_changed", G_CALLBACK (device_pre_property_changed), store); g_signal_connect (device, "capability_added", G_CALLBACK (emit_device_capability_added), store); g_signal_connect (device, "lock_acquired", G_CALLBACK (emit_device_lock_acquired), store); g_signal_connect (device, "lock_released", G_CALLBACK (emit_device_lock_released), store); property_index_check_all (store, device, TRUE); g_signal_emit (store, signals[STORE_CHANGED], 0, device, TRUE); out: ; }
/* Start a helper, returns true on a successfull start */ gboolean hald_runner_start (HalDevice *device, const gchar *command_line, char **extra_env, HalRunTerminatedCB cb, gpointer data1, gpointer data2) { DBusMessage *msg, *reply; DBusError err; DBusMessageIter iter; dbus_error_init(&err); msg = dbus_message_new_method_call("org.freedesktop.HalRunner", "/org/freedesktop/HalRunner", "org.freedesktop.HalRunner", "Start"); if (msg == NULL) DIE(("No memory")); dbus_message_iter_init_append(msg, &iter); if (!add_first_part(&iter, device, command_line, extra_env)) goto error; /* Wait for the reply, should be almost instantanious */ reply = dbus_connection_send_with_reply_and_block(runner_connection, msg, -1, &err); if (reply) { gboolean ret = (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_METHOD_RETURN); if (ret) { dbus_int64_t pid_from_runner; if (dbus_message_get_args (reply, &err, DBUS_TYPE_INT64, &pid_from_runner, DBUS_TYPE_INVALID)) { if (cb != NULL) { RunningProcess *rp; rp = g_new0 (RunningProcess, 1); rp->pid = (GPid) pid_from_runner; rp->cb = cb; rp->device = device; rp->data1 = data1; rp->data2 = data2; g_hash_table_insert (running_processes, (gpointer) rp->pid, rp); } } else { HAL_ERROR (("Error extracting out_pid from runner's Start()")); } } dbus_message_unref(reply); dbus_message_unref(msg); return ret; } error: dbus_message_unref(msg); return FALSE; }
RTIMUSettings::RTIMUSettings(const char *productType) { if ((strlen(productType) > 200) || (strlen(productType) == 0)) { HAL_ERROR("Product name too long or null - using default\n"); strcpy(m_filename, "RTIMULib.ini"); } else { sprintf(m_filename, "%s.ini", productType); } loadSettings(); }
void RTIMU::setCalibrationData() { float maxDelta = -1; float delta; if (m_settings->m_compassCalValid) { // find biggest range for (int i = 0; i < 3; i++) { if ((m_settings->m_compassCalMax.data(i) - m_settings->m_compassCalMin.data(i)) > maxDelta) maxDelta = m_settings->m_compassCalMax.data(i) - m_settings->m_compassCalMin.data(i); } if (maxDelta < 0) { HAL_ERROR("Error in compass calibration data\n"); return; } maxDelta /= 2.0f; // this is the max +/- range for (int i = 0; i < 3; i++) { delta = (m_settings->m_compassCalMax.data(i) - m_settings->m_compassCalMin.data(i)) / 2.0f; m_compassCalScale[i] = maxDelta / delta; // makes everything the same range m_compassCalOffset[i] = (m_settings->m_compassCalMax.data(i) + m_settings->m_compassCalMin.data(i)) / 2.0f; } } if (m_settings->m_temperatureCalValid) { HAL_INFO("Using temperature bias calibration\n"); } else { HAL_INFO("Temperature bias calibration not in use\n"); } if (m_settings->m_compassCalValid) { HAL_INFO("Using min/max compass calibration\n"); } else { HAL_INFO("min/max compass calibration not in use\n"); } if (m_settings->m_compassCalEllipsoidValid) { HAL_INFO("Using ellipsoid compass calibration\n"); } else { HAL_INFO("Ellipsoid compass calibration not in use\n"); } if (m_settings->m_accelCalValid) { HAL_INFO("Using accel calibration\n"); } else { HAL_INFO("Accel calibration not in use\n"); } if (m_settings->m_accelCalEllipsoidValid) { HAL_INFO("Using ellipsoid accelerometer calibration\n"); } else { HAL_INFO("Ellipsoid accelerometer calibration not in use\n"); } }
static void call_notify(DBusPendingCall *pending, void *user_data) { HelperData *hb = (HelperData *)user_data; dbus_uint32_t exitt = HALD_RUN_SUCCESS; dbus_int32_t return_code = 0; DBusMessage *m; GArray *error = NULL; DBusMessageIter iter; error = g_array_new(TRUE, FALSE, sizeof(char *)); m = dbus_pending_call_steal_reply(pending); if (dbus_message_get_type(m) != DBUS_MESSAGE_TYPE_METHOD_RETURN) goto malformed; if (!dbus_message_iter_init(m, &iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) goto malformed; dbus_message_iter_get_basic(&iter, &exitt); if (!dbus_message_iter_next(&iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) goto malformed; dbus_message_iter_get_basic(&iter, &return_code); while (dbus_message_iter_next(&iter) && dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) { const char *value; dbus_message_iter_get_basic(&iter, &value); g_array_append_vals(error, &value, 1); } hb->cb(hb->d, exitt, return_code, (gchar **)error->data, hb->data1, hb->data2); g_object_unref (hb->d); dbus_message_unref(m); dbus_pending_call_unref (pending); g_array_free(error, TRUE); return; malformed: /* Send a Fail callback on malformed messages */ HAL_ERROR (("Malformed or unexpected reply message")); hb->cb(hb->d, HALD_RUN_FAILED, return_code, NULL, hb->data1, hb->data2); g_object_unref (hb->d); dbus_message_unref(m); dbus_pending_call_unref (pending); g_array_free(error, TRUE); }
static gboolean get_system_idle_from_ck (void) { gboolean ret; DBusError error; DBusMessage *message; DBusMessage *reply; ret = FALSE; message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", "GetSystemIdleHint"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (con, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing Manager.GetSystemIdleHint on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &(system_is_idle), DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid GetSystemIdleHint reply from CK")); goto error; } dbus_message_unref (message); dbus_message_unref (reply); ret = TRUE; error: LIBHAL_FREE_DBUS_ERROR (&error); return ret; }
static void hotplug_event_begin_devfs_remove (HotplugEvent *hotplug_event, HalDevice *d) { if (d == NULL) { HAL_ERROR (("devpath %s not present in store, ignore event", hotplug_event->un.devfs.devfs_path)); hotplug_event_end ((void *) hotplug_event); return; } HAL_INFO (("hotplug_event_begin_devfs_remove %s", hal_device_get_udi (d))); hotplug_event_begin_remove_devinfo(d, hotplug_event->un.devfs.devfs_path, (void *) hotplug_event); }
static PropertyCacheItem* property_cache_item_get (const char *hal_device_udi) { PropertyCacheItem * pci = g_new0 (PropertyCacheItem,1); DBusError err; dbus_error_init (&err); pci->bus_no_present = libhal_device_property_exists (halctx, hal_device_udi, "usb_device.bus_number", &err); if (dbus_error_is_set (&err)) { HAL_ERROR (("Error: [%s]/[%s]", err.name, err.message)); dbus_error_free (&err); } if (pci->bus_no_present) pci->bus_no = libhal_device_get_property_int (halctx, hal_device_udi, "usb_device.bus_number", &err); LIBHAL_FREE_DBUS_ERROR (&err); pci->port_no_present = libhal_device_property_exists (halctx, hal_device_udi, "usb_device.linux.device_number", &err); LIBHAL_FREE_DBUS_ERROR (&err); if (pci->port_no_present) pci->port_no = libhal_device_get_property_int (halctx, hal_device_udi, "usb_device.linux.device_number", &err); LIBHAL_FREE_DBUS_ERROR (&err); pci->csr_is_dual_present = libhal_device_property_exists (halctx, hal_device_udi, "battery.csr.is_dual", &err); LIBHAL_FREE_DBUS_ERROR (&err); if (pci->csr_is_dual_present) pci->csr_is_dual = libhal_device_get_property_bool (halctx, hal_device_udi, "battery.csr.is_dual", &err); LIBHAL_FREE_DBUS_ERROR (&err); pci->current_charge_present = libhal_device_property_exists (halctx, hal_device_udi, "battery.charge_level.current", &err); LIBHAL_FREE_DBUS_ERROR (&err); if (pci->current_charge_present) pci->current_charge = libhal_device_get_property_int (halctx, hal_device_udi, "battery.charge_level.current", &err); LIBHAL_FREE_DBUS_ERROR (&err); return pci; }
static void hotplug_event_begin (HotplugEvent *hotplug_event) { switch (hotplug_event->type) { case HOTPLUG_EVENT_DEVFS: hotplug_event_begin_devfs (hotplug_event); break; default: HAL_ERROR (("Unknown hotplug event type %d", hotplug_event->type)); hotplug_event_end ((void *) hotplug_event); break; } }
/* This is the beginning of hotplug even handling */ void hotplug_event_begin_add_devinfo (HalDevice *d, HalDevice *parent, DevinfoDevHandler *handler, void *end_token) { HotplugEvent *hotplug_event = (HotplugEvent *)end_token; HAL_INFO(("Preprobing udi=%s", hal_device_get_udi (d))); if (parent == NULL && (strcmp(hotplug_event->un.devfs.devfs_path, "/") != 0)) { HAL_ERROR (("Parent is NULL, devfs_path=%s", hotplug_event->un.devfs.devfs_path)); goto skip; } if (parent != NULL && hal_device_property_get_bool (parent, "info.ignore")) { HAL_INFO (("Ignoring device since parent has info.ignore==TRUE")); goto skip; } if (hal_device_store_find (hald_get_tdl (), hal_device_get_udi (d)) == NULL) { /* add to TDL so preprobing callouts and prober can access it */ hal_device_store_add (hald_get_tdl (), d); } /* Process preprobe fdi files */ di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE); /* Run preprobe callouts */ hal_util_callout_device_preprobe (d, devinfo_callouts_preprobing_done, end_token, handler); return; skip: if (hal_device_store_find (hald_get_tdl (), hal_device_get_udi (d))) hal_device_store_remove (hald_get_tdl (), d); g_object_unref (d); hotplug_event_end (end_token); return; }
gboolean ck_tracker_init (CKTracker *tracker) { dbus_bool_t ret; ret = FALSE; if (!ck_tracker_init_get_seats_and_sessions (tracker)) { HAL_ERROR (("Could not get seats and sessions")); goto out; } HAL_INFO (("Got seats and sessions")); ret = TRUE; out: return ret; }
static void hotplug_event_begin_devfs (HotplugEvent *hotplug_event) { HalDevice *d; HAL_INFO (("hotplug_event_begin_devfs: %s", hotplug_event->un.devfs.devfs_path)); d = hal_device_store_match_key_value_string (hald_get_gdl (), "solaris.devfs_path", hotplug_event->un.devfs.devfs_path); if (hotplug_event->action == HOTPLUG_ACTION_ADD) { hotplug_event_begin_devfs_add (hotplug_event, d); } else if (hotplug_event->action == HOTPLUG_ACTION_REMOVE) { hotplug_event_begin_devfs_remove (hotplug_event, d); } else { HAL_ERROR (("unsupported action %d", hotplug_event->action)); g_object_unref (hotplug_event->d); hotplug_event_end ((void *) hotplug_event); } }
static DBusHandlerResult dbus_filter_function (DBusConnection *connection, DBusMessage *message, void *user_data) { #ifdef HAVE_CONKIT gboolean system_is_idle_new; if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Manager", "SystemIdleHintChanged")) { if (!dbus_message_get_args (message, NULL, DBUS_TYPE_BOOLEAN, &system_is_idle_new, DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SystemIdleHintChanged signal from CK")); goto out; } if (system_is_idle_new != system_is_idle) { system_is_idle = system_is_idle_new; update_polling_interval (); } } out: #endif /* HAVE_CONKIT */ /* Check, just before the next poll, whether lock state have changed; * * Note that we get called on at least these signals * * 1. CK.Manager - SystemIdleHintChanged * 2. CK.Seat - ActiveSessionChanged * 2. HAL.Manager - GlobalLockAcquired, GlobalLockReleased * 3. HAL.Device - LockAcquired, LockReleased * * meaning that every time the locking situation changes, we * will get updated. */ check_lock_state = TRUE; return DBUS_HANDLER_RESULT_HANDLED; }
bool RTIMUMagCal::magCalSaveRaw(const char *ellipsoidFitPath) { FILE *file; char *rawFile; if (ellipsoidFitPath != NULL) { // need to deal with ellipsoid fit processing rawFile = (char *)malloc(strlen(RTIMUCALDEFS_MAG_RAW_FILE) + strlen(ellipsoidFitPath) + 2); sprintf(rawFile, "%s/%s", ellipsoidFitPath, RTIMUCALDEFS_MAG_RAW_FILE); if ((file = fopen(rawFile, "w")) == NULL) { HAL_ERROR("Failed to open ellipsoid fit raw data file\n"); return false; } while (m_magCalCount > 0) { RTVector3 sample = removeMagCalData(); fprintf(file, "%f %f %f\n", sample.x(), sample.y(), sample.z()); } fclose(file); } return true; }
/* Getting current brightness */ static int get_leds_brightness (const char *udi) { FILE *f; char buf[64]; char path[256]; char *sysfs_path; int brightness; f = NULL; if (!g_hash_table_lookup_extended (leds, udi, NULL, (gpointer) &sysfs_path)) { return -1; } snprintf (path, sizeof (path), "%s/brightness", sysfs_path); if ((f = fopen (path, "rb")) == NULL) { HAL_WARNING(("Could not read brightness from '%s' for device '%s'", path, udi)); return -1; } if (fgets (buf, sizeof (buf), f) == NULL) { HAL_ERROR (("Cannot read from '%s' for device '%s'", path, udi)); goto out; } errno = 0; brightness = strtol (buf, NULL, 10); if (errno != 0) { brightness = -1; } out: if (f != NULL) fclose (f); return brightness; }
void RTIMUMagCal::setMinMaxCal() { float maxDelta = -1; float delta; // find biggest range for (int i = 0; i < 3; i++) { if ((m_magMax.data(i) - m_magMin.data(i)) > maxDelta) maxDelta = m_magMax.data(i) - m_magMin.data(i); } if (maxDelta < 0) { HAL_ERROR("Error in min/max calibration data\n"); return; } maxDelta /= 2.0f; // this is the max +/- range for (int i = 0; i < 3; i++) { delta = (m_magMax.data(i) -m_magMin.data(i)) / 2.0f; m_minMaxScale.setData(i, maxDelta / delta); // makes everything the same range m_minMaxOffset.setData(i, (m_magMax.data(i) + m_magMin.data(i)) / 2.0f); } }
/* TODO: Is it linux-specific way to find the device? */ static struct usb_device* find_device (PropertyCacheItem *pci) { struct usb_bus* curr_bus; char LUdirname[5]; char LUfname[5]; if (!(pci->bus_no_present && pci->port_no_present)) { /* no sysfs path */ HAL_ERROR (("No hal bus number and/or port number")); return NULL; } snprintf (LUdirname, sizeof (LUdirname), "%03d", pci->bus_no); snprintf (LUfname, sizeof (LUfname), "%03d",pci->port_no); HAL_DEBUG (("Looking for: [%s][%s]", LUdirname, LUfname)); for (curr_bus = usb_busses; curr_bus != NULL; curr_bus = curr_bus->next) { struct usb_device *curr_device; /* dbg ("Checking bus: [%s]", curr_bus->dirname); */ if (g_ascii_strcasecmp (LUdirname, curr_bus->dirname)) continue; for (curr_device = curr_bus->devices; curr_device != NULL; curr_device = curr_device->next) { /* dbg ("Checking port: [%s]", curr_device->filename); */ if (g_ascii_strcasecmp (LUfname, curr_device->filename)) continue; HAL_DEBUG (("Matched device: [%s][%s][%04X:%04X]", curr_bus->dirname, curr_device->filename, curr_device->descriptor.idVendor, curr_device->descriptor.idProduct)); return curr_device; } } return NULL; }
bool RTIMUSettings::discoverIMU(int& imuType, unsigned char& slaveAddress) { unsigned char result; unsigned char altResult; setI2CBus(m_I2CBus); if (!I2COpen()) { HAL_ERROR1("Failed to open I2C bus %d\n", m_I2CBus); return false; } if (I2CRead(MPU6050_ADDRESS0, MPU6050_WHO_AM_I, 1, &result, "")) { if (result == MPU6050_ID) { imuType = RTIMU_TYPE_MPU6050; slaveAddress = MPU6050_ADDRESS0; I2CClose(); HAL_INFO("Detected MPU6050 at standard address\n"); return true; } } if (I2CRead(MPU6050_ADDRESS1, MPU6050_WHO_AM_I, 1, &result, "")) { if (result == MPU6050_ID) { imuType = RTIMU_TYPE_MPU6050; slaveAddress = MPU6050_ADDRESS1; I2CClose(); HAL_INFO("Detected MPU6050 at option address\n"); return true; } } I2CClose(); HAL_ERROR("No IMU detected\n"); return false; }
static void remove_device (LibHalContext *ctx, const char *udi, const LibHalPropertySet *properties) { gpointer sysfs_path; gboolean handling_udi; HAL_DEBUG (("Removing channel for '%s'", udi)); handling_udi = g_hash_table_lookup_extended (leds, udi, NULL, &sysfs_path); if (!handling_udi) { HAL_ERROR(("DeviceRemove called for unknown device: '%s'.", udi)); return; } g_hash_table_remove (leds, udi); if (g_hash_table_size (leds) == 0) { HAL_INFO(("no more devices, exiting")); g_main_loop_quit (gmain); } }
void ck_tracker_process_system_bus_message (CKTracker *tracker, DBusMessage *message) { const char *seat_objpath; const char *session_objpath; dbus_bool_t session_is_active; GSList *i; CKSeat *seat; CKSession *session; /*HAL_INFO (("In ck_tracker_process_system_bus_message objpath=%s interface=%s method=%s", dbus_message_get_path (message), dbus_message_get_interface (message), dbus_message_get_member (message)));*/ /* TODO: also handle SeatRemoved and SeatAdded */ if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Manager", "SeatAdded")) { seat_objpath = dbus_message_get_path (message); if (!dbus_message_get_args (message, NULL, #ifdef HAVE_CK_0_3 DBUS_TYPE_OBJECT_PATH, &seat_objpath, #else DBUS_TYPE_STRING, &seat_objpath, #endif DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SeatAdded signal from CK")); goto out; } HAL_INFO (("Received SeatAdded '%s' from CK", seat_objpath)); seat = ck_seat_new (seat_objpath); /* get information */ if (!ck_seat_get_info (tracker, seat)) { HAL_ERROR (("Could not get information for seat '%s'", seat_objpath)); goto out; } tracker->seats = g_slist_prepend (tracker->seats, seat); if (tracker->seat_added_cb != NULL) { tracker->seat_added_cb (tracker, seat, tracker->user_data); } } else if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Manager", "SeatRemoved")) { seat_objpath = dbus_message_get_path (message); if (!dbus_message_get_args (message, NULL, #ifdef HAVE_CK_0_3 DBUS_TYPE_OBJECT_PATH, &seat_objpath, #else DBUS_TYPE_STRING, &seat_objpath, #endif DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SeatRemoved signal from CK")); goto out; } HAL_INFO (("Received SeatRemoved '%s' from CK", seat_objpath)); for (i = tracker->seats; i != NULL; i = g_slist_next (i)) { seat = (CKSeat *) i->data; if (strcmp (seat->seat_objpath, seat_objpath) == 0) { tracker->seats = g_slist_remove (tracker->seats, seat); if (tracker->seat_removed_cb != NULL) { tracker->seat_removed_cb (tracker, seat, tracker->user_data); } ck_seat_unref (seat); break; } } if (i == NULL) { HAL_ERROR (("No such seat '%s'", seat_objpath)); } } else if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Seat", "SessionAdded")) { seat_objpath = dbus_message_get_path (message); if (!dbus_message_get_args (message, NULL, #ifdef HAVE_CK_0_3 DBUS_TYPE_OBJECT_PATH, &session_objpath, #else DBUS_TYPE_STRING, &session_objpath, #endif DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SessionAdded signal from CK")); goto out; } HAL_INFO (("Received SessionAdded '%s' from CK on seat '%s'", session_objpath, seat_objpath)); for (i = tracker->seats; i != NULL; i = g_slist_next (i)) { seat = (CKSeat *) i->data; if (strcmp (seat->seat_objpath, seat_objpath) == 0) { session = ck_session_new (session_objpath); /* get information: is_active etc. */ if (!ck_session_get_info (tracker, session)) { HAL_ERROR (("Could not get information for session '%s'", session_objpath)); goto out; } ck_seat_attach_session (seat, session); tracker->sessions = g_slist_prepend (tracker->sessions, session); if (tracker->session_added_cb != NULL) { tracker->session_added_cb (tracker, session, tracker->user_data); } break; } } if (i == NULL) { HAL_ERROR (("No seat '%s for session '%s'", seat_objpath, session_objpath)); } } else if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Seat", "SessionRemoved")) { seat_objpath = dbus_message_get_path (message); if (!dbus_message_get_args (message, NULL, #ifdef HAVE_CK_0_3 DBUS_TYPE_OBJECT_PATH, &session_objpath, #else DBUS_TYPE_STRING, &session_objpath, #endif DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SessionRemoved signal from CK")); goto out; } HAL_INFO (("Received SessionRemoved '%s' from CK on seat '%s'", session_objpath, seat_objpath)); for (i = tracker->sessions; i != NULL; i = g_slist_next (i)) { session = (CKSession *) i->data; if (strcmp (session->session_objpath, session_objpath) == 0) { if (tracker->session_removed_cb != NULL) { tracker->session_removed_cb (tracker, session, tracker->user_data); } if (session->seat == NULL) { HAL_ERROR (("Session '%s' to be removed is not attached to a seat", session_objpath)); } else { ck_seat_detach_session (session->seat, session); } tracker->sessions = g_slist_remove (tracker->sessions, session); ck_session_unref (session); break; } } if (i == NULL) { HAL_ERROR (("No such session '%s'", session_objpath)); } } else if (dbus_message_is_signal (message, "org.freedesktop.ConsoleKit.Session", "ActiveChanged")) { session_objpath = dbus_message_get_path (message); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_BOOLEAN, &session_is_active, DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid SessionRemoved signal from CK")); goto out; } HAL_INFO (("Received ActiveChanged to %s from CK on session '%s'", session_is_active ? "ACTIVE" : "INACTIVE", session_objpath)); for (i = tracker->sessions; i != NULL; i = g_slist_next (i)) { session = (CKSession *) i->data; if (strcmp (session->session_objpath, session_objpath) == 0) { session->is_active = session_is_active; if (tracker->session_active_changed_cb != NULL) { tracker->session_active_changed_cb (tracker, session, tracker->user_data); } break; } } if (i == NULL) { HAL_ERROR (("No such session '%s'", session_objpath)); } } else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { char *name; char *old_service_name; char *new_service_name; if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old_service_name, DBUS_TYPE_STRING, &new_service_name, DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid NameOwnerChanged signal from bus!")); goto out; } if (new_service_name == NULL || old_service_name == NULL) { HAL_ERROR (("new_service_name == NULL || old_service_name == NULL")); goto out; } if (strlen (new_service_name) == 0 && strcmp (name, "org.freedesktop.ConsoleKit") == 0) { HAL_INFO (("uh, oh, ConsoleKit went away!")); ck_tracker_remove_all_seats_and_sessions (tracker); if (tracker->service_disappeared_cb != NULL) { tracker->service_disappeared_cb (tracker, tracker->user_data); } } if (strlen (old_service_name) == 0 && strcmp (name, "org.freedesktop.ConsoleKit") == 0) { HAL_INFO (("ConsoleKit reappeared!")); ck_tracker_init (tracker); if (tracker->service_appeared_cb != NULL) { tracker->service_appeared_cb (tracker, tracker->user_data); } } } out: ; }
gboolean hald_runner_start_runner(void) { DBusServer *server = NULL; DBusError err; GError *error = NULL; GPid pid; char *argv[] = { NULL, NULL}; char *env[] = { NULL, NULL, NULL, NULL}; const char *hald_runner_path; char *server_addr; running_processes = g_hash_table_new (g_direct_hash, g_direct_equal); dbus_error_init(&err); server = dbus_server_listen(DBUS_SERVER_ADDRESS, &err); if (server == NULL) { HAL_ERROR (("Cannot create D-BUS server for the runner")); goto error; } dbus_server_setup_with_g_main(server, NULL); dbus_server_set_new_connection_function(server, handle_connection, NULL, NULL); argv[0] = "hald-runner"; server_addr = dbus_server_get_address (server); env[0] = g_strdup_printf("HALD_RUNNER_DBUS_ADDRESS=%s", server_addr); dbus_free (server_addr); hald_runner_path = g_getenv("HALD_RUNNER_PATH"); if (hald_runner_path != NULL) { env[1] = g_strdup_printf ("PATH=%s:" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR ":" PACKAGE_BIN_DIR, hald_runner_path); } else { env[1] = g_strdup_printf ("PATH=" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR ":" PACKAGE_BIN_DIR); } /*env[2] = "DBUS_VERBOSE=1";*/ if (!g_spawn_async(NULL, argv, env, G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, &error)) { HAL_ERROR (("Could not spawn runner : '%s'", error->message)); g_error_free (error); goto error; } g_free(env[0]); g_free(env[1]); HAL_INFO (("Runner has pid %d", pid)); g_child_watch_add(pid, runner_died, NULL); while (runner_connection == NULL) { /* Wait for the runner */ g_main_context_iteration(NULL, TRUE); } return TRUE; error: if (server != NULL) dbus_server_unref(server); return FALSE; }
static gboolean ck_tracker_init_get_seats_and_sessions (CKTracker *tracker) { gboolean ret; DBusError error; DBusMessage *message; DBusMessage *reply; DBusMessageIter iter; DBusMessageIter iter_array; ret = FALSE; /* first build array of existing seats and sessions */ message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", "GetSeats"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing GetSeats on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } dbus_message_iter_init (reply, &iter); if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) { HAL_WARNING (("Expecting an array from GetSeats on ConsoleKit.")); dbus_message_unref (message); dbus_message_unref (reply); goto error; } dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) == DBUS_TYPE_OBJECT_PATH) { const char *seat_objpath; CKSeat *seat; dbus_message_iter_get_basic (&iter_array, &seat_objpath); HAL_INFO (("got seat '%s'", seat_objpath)); seat = ck_seat_new (seat_objpath); /* get information */ if (!ck_seat_get_info (tracker, seat)) { HAL_ERROR (("Could not get information for seat '%s'", seat_objpath)); dbus_message_unref (message); dbus_message_unref (reply); goto error; } /* for each seat, get the sessions */ if (!ck_tracker_init_get_sessions_for_seat (tracker, seat)) { HAL_ERROR (("Could not get sessions for seat '%s'", seat_objpath)); dbus_message_unref (message); dbus_message_unref (reply); goto error; } tracker->seats = g_slist_prepend (tracker->seats, seat); dbus_message_iter_next (&iter_array); } dbus_message_unref (message); dbus_message_unref (reply); HAL_INFO (("Got seats")); ret = TRUE; error: if (dbus_error_is_set (&error)) dbus_error_free (&error); return ret; }
static gboolean ck_tracker_init_get_sessions_for_seat (CKTracker *tracker, CKSeat *seat) { gboolean ret; DBusError error; DBusMessage *message; DBusMessage *reply; DBusMessageIter iter; DBusMessageIter iter_array; ret = FALSE; message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", seat->seat_objpath, "org.freedesktop.ConsoleKit.Seat", "GetSessions"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing GetSeats on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } dbus_message_iter_init (reply, &iter); if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY) { HAL_WARNING (("Expecting an array from GetSessions on ConsoleKit.")); dbus_message_unref (message); dbus_message_unref (reply); goto error; } dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) == DBUS_TYPE_OBJECT_PATH) { const char *session_objpath; CKSession *session; dbus_message_iter_get_basic (&iter_array, &session_objpath); HAL_INFO (("got session '%s' for seat '%s'", session_objpath, seat->seat_objpath)); session = ck_session_new (session_objpath); /* get information: is_active etc. */ if (!ck_session_get_info (tracker, session)) { HAL_ERROR (("Could not get information for session '%s'", session_objpath)); dbus_message_unref (message); dbus_message_unref (reply); goto error; } ck_seat_attach_session (seat, session); tracker->sessions = g_slist_prepend (tracker->sessions, session); dbus_message_iter_next (&iter_array); } dbus_message_unref (message); dbus_message_unref (reply); HAL_INFO (("Got all sessions on seat '%s'", seat->seat_objpath)); ret = TRUE; error: if (dbus_error_is_set (&error)) dbus_error_free (&error); return ret; }
static gboolean ck_session_get_info (CKTracker *tracker, CKSession *session) { gboolean ret; DBusError error; DBusMessage *message; DBusMessage *reply; char *hostname; ret = FALSE; message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", session->session_objpath, "org.freedesktop.ConsoleKit.Session", "IsActive"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing Session.IsActive on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &(session->is_active), DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid IsActive reply from CK")); goto error; } dbus_message_unref (message); dbus_message_unref (reply); message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", session->session_objpath, "org.freedesktop.ConsoleKit.Session", "IsLocal"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing Session.IsLocal on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &(session->is_local), DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid IsLocal reply from CK")); goto error; } dbus_message_unref (message); dbus_message_unref (reply); message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", session->session_objpath, "org.freedesktop.ConsoleKit.Session", "GetRemoteHostName"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing Session.GetRemoteHostName on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &hostname, DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid GetRemoteHostName reply from CK")); goto error; } session->hostname = g_strdup (hostname); dbus_message_unref (message); dbus_message_unref (reply); message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", session->session_objpath, "org.freedesktop.ConsoleKit.Session", "GetUnixUser"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (tracker->dbus_connection, message, -1, &error); if (reply == NULL || dbus_error_is_set (&error)) { HAL_ERROR (("Error doing Session.GetUnixUser on ConsoleKit: %s: %s", error.name, error.message)); dbus_message_unref (message); if (reply != NULL) dbus_message_unref (reply); goto error; } if (!dbus_message_get_args (reply, NULL, #ifdef HAVE_CK_0_3 DBUS_TYPE_UINT32, &(session->user), #else DBUS_TYPE_INT32, &(session->user), #endif DBUS_TYPE_INVALID)) { HAL_ERROR (("Invalid GetUnixUser reply from CK")); goto error; } dbus_message_unref (message); dbus_message_unref (reply); HAL_INFO (("Got active state (%s) and uid %d on session '%s'", session->is_active ? "ACTIVE" : "INACTIVE", session->user, session->session_objpath)); ret = TRUE; error: if (dbus_error_is_set (&error)) dbus_error_free (&error); return ret; }
int main (int argc, char *argv[]) { off_t address = 0; size_t length = 0; int fd; int state; int retval = 0; struct pci_access *pacc; struct pci_dev *dev; DBusError err; setup_logger (); udi = getenv ("UDI"); HAL_DEBUG (("udi=%s", udi)); if (udi == NULL) { HAL_ERROR (("No device specified")); return -2; } dbus_error_init (&err); if ((halctx = libhal_ctx_init_direct (&err)) == NULL) { HAL_ERROR (("Cannot connect to hald")); retval = -3; goto out; } if (!libhal_device_addon_is_ready (halctx, udi, &err)) { retval = -4; goto out; } conn = libhal_ctx_get_dbus_connection (halctx); dbus_connection_setup_with_g_main (conn, NULL); dbus_connection_set_exit_on_disconnect (conn, 0); dbus_connection_add_filter (conn, filter_function, NULL, NULL); /* Search for the graphics card. */ /* Default values: */ /* address = 0x90300000; */ /* length = 0x20000; */ pacc = pci_alloc(); pci_init(pacc); pci_scan_bus(pacc); for(dev=pacc->devices; dev; dev=dev->next) { /* Iterate over all devices */ pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES); if ((dev->vendor_id == 0x1002) && (dev->device_id == 0x71c5)) { // ATI X1600 address = dev->base_addr[2]; length = dev->size[2]; } } pci_cleanup(pacc); HAL_DEBUG (("addr 0x%x len=%d", address, length)); if (!address) { HAL_DEBUG (("Failed to detect ATI X1600, aborting...")); retval = 1; goto out; } fd = open ("/dev/mem", O_RDWR); if (fd < 0) { HAL_DEBUG (("cannot open /dev/mem")); retval = 1; goto out; } memory = mmap (NULL, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, address); if (memory == MAP_FAILED) { HAL_ERROR (("mmap failed")); retval = 2; goto out; } /* Is it really necessary ? */ OUTREG(0x4dc, 0x00000005); state = INREG(0x7ae4); OUTREG(0x7ae4, state); /* Allow access to porta 0x300 through 0x304 */ if (ioperm (0x300, 5, 1) < 0) { HAL_ERROR (("ioperm failed (you should be root).")); exit(1); } /* this works because we hardcoded the udi's in the <spawn> in the fdi files */ if (!libhal_device_claim_interface (halctx, "/org/freedesktop/Hal/devices/macbook_pro_lcd_panel", "org.freedesktop.Hal.Device.LaptopPanel", " <method name=\"SetBrightness\">\n" " <arg name=\"brightness_value\" direction=\"in\" type=\"i\"/>\n" " <arg name=\"return_code\" direction=\"out\" type=\"i\"/>\n" " </method>\n" " <method name=\"GetBrightness\">\n" " <arg name=\"brightness_value\" direction=\"out\" type=\"i\"/>\n" " </method>\n", &err)) { HAL_ERROR (("Cannot claim interface 'org.freedesktop.Hal.Device.LaptopPanel'")); retval = -4; goto out; } if (!libhal_device_claim_interface (halctx, "/org/freedesktop/Hal/devices/macbook_pro_light_sensor", "org.freedesktop.Hal.Device.LightSensor", " <method name=\"GetBrightness\">\n" " <arg name=\"brightness_value\" direction=\"out\" type=\"ai\"/>\n" " </method>\n", &err)) { HAL_ERROR (("Cannot claim interface 'org.freedesktop.Hal.Device.LightSensor'")); retval = -4; goto out; } if (!libhal_device_claim_interface (halctx, "/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight", "org.freedesktop.Hal.Device.KeyboardBacklight", " <method name=\"GetBrightness\">\n" " <arg name=\"brightness_value\" direction=\"out\" type=\"i\"/>\n" " </method>\n" " <method name=\"SetBrightness\">\n" " <arg name=\"brightness_value\" direction=\"in\" type=\"i\"/>\n" " </method>\n", &err)) { HAL_ERROR (("Cannot claim interface 'org.freedesktop.Hal.Device.KeyboardBacklight'")); retval = -4; goto out; } main_loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (main_loop); return 0; out: HAL_DEBUG (("An error occured, exiting cleanly")); LIBHAL_FREE_DBUS_ERROR (&err); if (halctx != NULL) { libhal_ctx_shutdown (halctx, &err); LIBHAL_FREE_DBUS_ERROR (&err); libhal_ctx_free (halctx); } return retval; }
bool RTIMUSettings::saveSettings() { if (!(m_fd = fopen(m_filename, "w"))) { HAL_ERROR("Failed to open settings file for save"); return false; } // General settings setComment("#####################################################################"); setComment(""); setComment("RTIMULib settings file"); setBlank(); setComment("General settings"); setComment(""); setBlank(); setComment("IMU type - "); setComment(" 0 = Auto discover"); setComment(" 1 = Null (used when data is provided from a remote IMU"); setComment(" 2 = InvenSense MPU-6050"); setValue(RTIMULIB_IMU_TYPE, m_imuType); setBlank(); setComment(""); setComment("Fusion type type - "); setComment(" 0 - Null. Use if only sensor data required without fusion"); setComment(" 1 - Kalman STATE4"); setComment(" 2 - RTQF"); setComment(" 3 - Kalman STATE7"); setValue(RTIMULIB_FUSION_TYPE, m_fusionType); setBlank(); setComment(""); setComment("I2C Bus (between 0 and 7) "); setValue(RTIMULIB_I2C_BUS, m_I2CBus); setBlank(); setComment(""); setComment("I2C slave address (filled in automatically by auto discover) "); setValue(RTIMULIB_I2C_SLAVEADDRESS, m_I2CSlaveAddress); // Compass calibration settings setBlank(); setComment("#####################################################################"); setComment(""); setBlank(); setComment("Compass calibration"); setValue(RTIMULIB_COMPASSCAL_VALID, m_compassCalValid); setValue(RTIMULIB_COMPASSCAL_MINX, m_compassCalMin.x()); setValue(RTIMULIB_COMPASSCAL_MINY, m_compassCalMin.y()); setValue(RTIMULIB_COMPASSCAL_MINZ, m_compassCalMin.z()); setValue(RTIMULIB_COMPASSCAL_MAXX, m_compassCalMax.x()); setValue(RTIMULIB_COMPASSCAL_MAXY, m_compassCalMax.y()); setValue(RTIMULIB_COMPASSCAL_MAXZ, m_compassCalMax.z()); // MPU-6050 settings setBlank(); setComment("#####################################################################"); setComment(""); setComment("MPU-6050 settings"); setComment(""); setBlank(); setComment("Gyro sample rate (between 5Hz and 1000Hz) "); setValue(RTIMULIB_MPU6050_GYROACCEL_SAMPLERATE, m_MPU6050GyroAccelSampleRate); setBlank(); setComment(""); setComment("Compass sample rate (between 1Hz and 100Hz) "); setValue(RTIMULIB_MPU6050_COMPASS_SAMPLERATE, m_MPU6050CompassSampleRate); setBlank(); setComment(""); setComment("Gyro/accel low pass filter - "); setComment(" 0 - gyro: 256Hz, accel: 260Hz"); setComment(" 1 - gyro: 188Hz, accel: 184Hz"); setComment(" 2 - gyro: 98Hz, accel: 98Hz"); setComment(" 3 - gyro: 42Hz, accel: 44Hz"); setComment(" 4 - gyro: 20Hz, accel: 21Hz"); setComment(" 5 - gyro: 10Hz, accel: 10Hz"); setComment(" 6 - gyro: 5Hz, accel: 5Hz"); setValue(RTIMULIB_MPU6050_GYROACCEL_LPF, m_MPU6050GyroAccelLpf); setBlank(); setComment(""); setComment("Gyro full scale range - "); setComment(" 0 - +/- 250 degress per second"); setComment(" 8 - +/- 500 degress per second"); setComment(" 16 - +/- 1000 degress per second"); setComment(" 24 - +/- 2000 degress per second"); setValue(RTIMULIB_MPU6050_GYRO_FSR, m_MPU6050GyroFsr); setBlank(); setComment(""); setComment("Accel full scale range - "); setComment(" 0 - +/- 2g"); setComment(" 8 - +/- 4g"); setComment(" 16 - +/- 8g"); setComment(" 24 - +/- 16g"); setValue(RTIMULIB_MPU6050_ACCEL_FSR, m_MPU6050AccelFsr); }