Example #1
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if ((brl->data = malloc(sizeof(*brl->data)))) {
    memset(brl->data, 0, sizeof(*brl->data));

    if (connectResource(brl, device)) {
      unsigned char response[MAXIMUM_RESPONSE_SIZE];

      if (probeBrailleDisplay(brl, PROBE_RETRY_LIMIT, NULL, PROBE_INPUT_TIMEOUT,
                              writeIdentityRequest,
                              readPacket, &response, sizeof(response),
                              isIdentityResponse)) {
        setBrailleKeyTable(brl, &KEY_TABLE_DEFINITION(all));
        MAKE_OUTPUT_TABLE(0X01, 0X04, 0X10, 0X02, 0X08, 0X20, 0X40, 0X80);

        brl->textColumns = MAXIMUM_CELL_COUNT;
        brl->data->forceRewrite = 1;
        return 1;
      }

      disconnectBrailleResource(brl, NULL);
    }

    free(brl->data);
  } else {
    logMallocError();
  }

  return 0;
}
Example #2
0
static const KeyTableDefinition *
getKeyTableDefinition (BrailleDisplay *brl) {
  switch (brl->textColumns) {
    case 24:
      if (!brl->statusColumns) return &KEY_TABLE_DEFINITION(kbd);
      break;

    case 40:
      if (!brl->statusColumns) return &KEY_TABLE_DEFINITION(fk);
      return &KEY_TABLE_DEFINITION(fk_s);

    default:
      break;
  }

  return &KEY_TABLE_DEFINITION(default);
}
Example #3
0
static void
setCellCounts (BrailleDisplay *brl, int size) {
  brl->statusColumns = ARRAY_COUNT(statusCells);
  brl->statusRows = 1;
  brl->textColumns = size - brl->statusColumns;
  brl->textRows = 1;

  {
    const KeyTableDefinition *ktd = &KEY_TABLE_DEFINITION(all);

    brl->keyBindings = ktd->bindings;
    brl->keyNameTables = ktd->names;
  }
}
Example #4
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if ((brl->data = malloc(sizeof(*brl->data)))) {
    memset(brl->data, 0, sizeof(*brl->data));
    brl->data->brailleDevice = -1;

#ifdef KEYBOARD_DEVICE_NAME
    brl->data->keyboardDevice = -1;
#endif /* KEYBOARD_DEVICE_NAME */

    if (openBrailleDevice(brl, device)) {
      logBrailleVersion(brl);

#ifdef KEYBOARD_DEVICE_NAME
      if (openKeyboardDevice(brl)) {
#endif /* KEYBOARD_DEVICE_NAME */
        if (clearBrailleCells(brl)) {
#ifdef KEYBOARD_DEVICE_NAME
          {
            const KeyTableDefinition *ktd = &KEY_TABLE_DEFINITION(all);

            brl->keyBindings = ktd->bindings;
            brl->keyNames = ktd->names;
          }
#endif /* KEYBOARD_DEVICE_NAME */

          brl->textColumns = BRAILLE_CELL_COUNT;
          makeOutputTable(dotsTable_ISO11548_1);
          brl->data->forceRewrite = 1;
          return 1;
        }

#ifdef KEYBOARD_DEVICE_NAME
        closeKeyboardDevice(brl);
      }
#endif /* KEYBOARD_DEVICE_NAME */

      closeBrailleDevice(brl);
    }

    free(brl->data);
  } else {
    logMallocError();
  }

  return 0;
}
Example #5
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if (connectResource(device)) {
    ResponsePacket response;

    if (probeBrailleDisplay(brl, 0, gioEndpoint, 100,
                              writeIdentifyRequest,
                              readResponse, &response, sizeof(response),
                              isIdentityResponse)) {
      statusCells = response.data.values.description.statusCells;
      brl->textColumns = response.data.values.description.textCells;
      brl->textRows = 1;

      if ((statusCells == 5) && (brl->textColumns == 30)) {
        statusCells -= 2;
        brl->textColumns += 2;
      }

      dataCells = brl->textColumns * brl->textRows;
      cellCount = statusCells + dataCells;

      {
        const KeyTableDefinition *ktd = &KEY_TABLE_DEFINITION(all);
        brl->keyBindings = ktd->bindings;
        brl->keyNameTables = ktd->names;
      }

      makeOutputTable(dotsTable_ISO11548_1);
      makeInputTable();

      if ((cellBuffer = malloc(cellCount))) {
        memset(cellBuffer, 0, cellCount);
        statusArea = cellBuffer;
        dataArea = statusArea + statusCells;
        refreshCells(brl);
        return 1;
      } else {
        logSystemError("cell buffer allocation");
      }
    }

    disconnectResource();
  }

  return 0;
}
Example #6
0
static int
brl_construct (BrailleDisplay *brl, char **parameters, const char *device) {
  if ((brl->data = malloc(sizeof(*brl->data)))) {
    memset(brl->data, 0, sizeof(*brl->data));
    brl->data->gioEndpoint = NULL;

    if (connectResource(brl, device)) {
      unsigned char response[MAXIMUM_RESPONSE_SIZE];

      if (probeBrailleDisplay(brl, PROBE_RETRY_LIMIT,
                              brl->data->gioEndpoint, PROBE_INPUT_TIMEOUT,
                              writeIdentityRequest,
                              readPacket, &response, sizeof(response),
                              isIdentityResponse)) {
        {
          const KeyTableDefinition *ktd = &KEY_TABLE_DEFINITION(all);

          brl->keyBindings = ktd->bindings;
          brl->keyNameTables = ktd->names;
        }

        {
          static const DotsTable dots = {
            0X01, 0X04, 0X10, 0X02, 0X08, 0X20, 0X40, 0X80
          };

          makeOutputTable(dots);
        }

        brl->textColumns = MAXIMUM_CELL_COUNT;
        brl->data->forceRewrite = 1;
        return 1;
      }

      gioDisconnectResource(brl->data->gioEndpoint);
    }

    free(brl->data);
  } else {
    logMallocError();
  }

  return 0;
}
Example #7
0
  HT_ModelIdentifier identifier:8;
  unsigned char textCells;
  unsigned char statusCells;

  unsigned char sessionEndLength;

  unsigned hasATC:1; /* Active Tactile Control */
} ModelEntry;

#define HT_BYTE_SEQUENCE(name,bytes) .name##Address = bytes, .name##Length = sizeof(bytes)
static const ModelEntry modelTable[] = {
  { .identifier = HT_MODEL_Modular20,
    .name = "Modular 20+4",
    .textCells = 20,
    .statusCells = 4,
    .keyTableDefinition = &KEY_TABLE_DEFINITION(mdlr),
    .interpretByte = interpretByte_key,
    .writeCells = writeCells_statusAndText
  }
  ,
  { .identifier = HT_MODEL_Modular40,
    .name = "Modular 40+4",
    .textCells = 40,
    .statusCells = 4,
    .keyTableDefinition = &KEY_TABLE_DEFINITION(mdlr),
    .interpretByte = interpretByte_key,
    .writeCells = writeCells_statusAndText
  }
  ,
  { .identifier = HT_MODEL_Modular80,
    .name = "Modular 80+4",
Example #8
0
    *checksum = sum;
  }

  return writeBytes(brl, packet, byte - packet);
}


static int
getBrailleSenseDefaultCellCount (BrailleDisplay *brl, unsigned int *count) {
  *count = 32;
  return 1;
}

static const ProtocolEntry brailleSenseProtocol = {
  .modelName = "Braille Sense",
  .keyTableDefinition = &KEY_TABLE_DEFINITION(sense),
  .getDefaultCellCount = getBrailleSenseDefaultCellCount
};


static int
getSyncBrailleDefaultCellCount (BrailleDisplay *brl, unsigned int *count) {
  return 0;
}

static const ProtocolEntry syncBrailleProtocol = {
  .modelName = "SyncBraille",
  .keyTableDefinition = &KEY_TABLE_DEFINITION(sync),
  .getDefaultCellCount = getSyncBrailleDefaultCellCount
};
Example #9
0
  &KEY_TABLE_DEFINITION(pacmate),
END_KEY_TABLE_LIST

typedef struct {
  const KeyTableDefinition *keyTableDefinition;
  signed char hotkeysRow;
} ModelTypeEntry;

typedef enum {
  MOD_TYPE_Focus,
  MOD_TYPE_PacMate
} ModelType;

static const ModelTypeEntry modelTypeTable[] = {
  [MOD_TYPE_Focus] = {
    .keyTableDefinition = &KEY_TABLE_DEFINITION(focus1),
    .hotkeysRow = -1
  },

  [MOD_TYPE_PacMate] = {
    .keyTableDefinition = &KEY_TABLE_DEFINITION(pacmate),
    .hotkeysRow = 1
  }
};

typedef struct {
  const char *identifier;
  const DotsTable *dotsTable;
  unsigned char cellCount;
  unsigned char type;
} ModelEntry;
Example #10
0
    while (ptr != byte) sum += *ptr++;
    *checksum = sum;
  }

  return writeBraillePacket(brl, brl->data->gioEndpoint, packet, byte - packet);
}


static int
getBrailleSenseCellCount (BrailleDisplay *brl, unsigned int *count) {
  *count = 32;
  return 1;
}

static const ProtocolOperations brailleSenseOperations = {
  "Braille Sense", &KEY_TABLE_DEFINITION(sense),
  getBrailleSenseCellCount
};


static int
getSyncBrailleCellCount (BrailleDisplay *brl, unsigned int *count) {
  static const unsigned char data[] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  };

  if (writePacket(brl, 0XFB, 0X01, data, sizeof(data), NULL, 0)) {
    InputPacket packet;

    while (gioAwaitInput(brl->data->gioEndpoint, 1000)) {
Example #11
0
      enqueueUpdatedKeys(brl, pressedKeys, &brl->data->pressedKeys,
                         HD_GRP_NavigationKeys, 0);
      return 1;
    }
  }

  return 0;
}

static const ModelEntry modelEntry_ProfiLine = {
  .modelName = "ProfiLine USB",
  .textCellCount = 80,
  .statusCellCount = 4,

  .keyTableDefinition = &KEY_TABLE_DEFINITION(pfl),
  .interpretKeyCode = interpretKeyCode_ProfiLine,
  .firstRoutingKey = 0X20,

  .acknowledgementResponse = 0X7E
};

static const ModelEntry modelEntry_MobilLine = {
  .modelName = "MobilLine USB",
  .textCellCount = 40,
  .statusCellCount = 2,

  .keyTableDefinition = &KEY_TABLE_DEFINITION(mbl),
  .interpretKeyCode = interpretKeyCode_MobilLine,
  .firstRoutingKey = 0X40,