Skip to content

Commit

Permalink
Merge pull request #145 from jnzw/jwu/jp5-patches
Browse files Browse the repository at this point in the history
Fix Y12I and DFU
  • Loading branch information
dmipx committed Jan 3, 2023
2 parents dc71810 + 4d5a8e8 commit 72f6c3b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ static const struct ds5_format ds5_y_formats_ds5u[] = {
}, {
.data_type = 0x24, /* 24-bit Calibration */
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24, /* FIXME */
.n_resolutions = ARRAY_SIZE(d46x_calibration_sizes),
.resolutions = d46x_calibration_sizes,
.n_resolutions = ARRAY_SIZE(d43x_calibration_sizes),
.resolutions = d43x_calibration_sizes,
},
};

Expand Down Expand Up @@ -3419,16 +3419,20 @@ static ssize_t ds5_dfu_device_read(struct file *flip,
char __user *buffer, size_t len, loff_t *offset)
{
struct ds5 *state = flip->private_data;
u16 fw_ver;
char msg[20];
u16 fw_ver, fw_build;
char msg[32];
int ret = 0;

if (mutex_lock_interruptible(&state->lock))
return -ERESTARTSYS;
ret = ds5_read(state, DS5_FW_VERSION, &fw_ver);
ret |= ds5_read(state, DS5_FW_VERSION, &fw_ver);
ret |= ds5_read(state, DS5_FW_BUILD, &fw_build);
if (ret < 0)
goto e_dfu_read_failed;
snprintf(msg, sizeof(msg) ,"DFU info: \tver: (0x%x)\n", fw_ver);
snprintf(msg, sizeof(msg) ,"DFU info: \tver: %d.%d.%d.%d\n",
(fw_ver >> 8) & 0xff, fw_ver & 0xff,
(fw_build >> 8) & 0xff, fw_build & 0xff);

if (copy_to_user(buffer, msg, strlen(msg)))
ret = -EFAULT;
else {
Expand Down Expand Up @@ -3521,8 +3525,11 @@ static ssize_t ds5_dfu_device_write(struct file *flip,
return len;

dfu_write_error:
//TODO: Reset device here
state->dfu_dev.dfu_state_flag = DS5_DFU_ERROR;
// Reset DFU device to IDLE states
ret = ds5_write(state, 0x5010, 0x0);
if (!ret)
state->dfu_dev.dfu_state_flag = DS5_DFU_IDLE;
mutex_unlock(&state->lock);
return ret;
};
Expand Down

0 comments on commit 72f6c3b

Please sign in to comment.