kopia lustrzana https://gitlab.com/sane-project/backends
kvs20xx: pack struct window and use proper types, remove lvalue casts
rodzic
9fde3bdd80
commit
606843d04e
|
@ -111,24 +111,24 @@ struct scanner
|
|||
struct window
|
||||
{
|
||||
u8 reserved[6];
|
||||
u8 window_descriptor_block_length[2];
|
||||
u16 window_descriptor_block_length;
|
||||
|
||||
u8 window_identifier;
|
||||
u8 reserved2;
|
||||
u8 x_resolution[2];
|
||||
u8 y_resolution[2];
|
||||
u8 upper_left_x[4];
|
||||
u8 upper_left_y[4];
|
||||
u8 width[4];
|
||||
u8 length[4];
|
||||
u16 x_resolution;
|
||||
u16 y_resolution;
|
||||
u32 upper_left_x;
|
||||
u32 upper_left_y;
|
||||
u32 width;
|
||||
u32 length;
|
||||
u8 brightness;
|
||||
u8 threshold;
|
||||
u8 contrast;
|
||||
u8 image_composition;
|
||||
u8 bit_per_pixel;
|
||||
u8 halftone_pattern[2];
|
||||
u16 halftone_pattern;
|
||||
u8 reserved3;
|
||||
u8 bit_ordering[2];
|
||||
u16 bit_ordering;
|
||||
u8 compression_type;
|
||||
u8 compression_argument;
|
||||
u8 reserved4[6];
|
||||
|
@ -141,8 +141,8 @@ struct window
|
|||
u8 mcd_lamp_dfeed_sens;
|
||||
u8 reserved5;
|
||||
u8 document_size;
|
||||
u8 document_width[4];
|
||||
u8 document_length[4];
|
||||
u32 document_width;
|
||||
u32 document_length;
|
||||
u8 ahead_deskew_dfeed_scan_area_fspeed_rshad;
|
||||
u8 continuous_scanning_pages;
|
||||
u8 automatic_threshold_mode;
|
||||
|
@ -151,7 +151,7 @@ struct window
|
|||
u8 b_wnr_noise_reduction;
|
||||
u8 mfeed_toppos_btmpos_dsepa_hsepa_dcont_rstkr;
|
||||
u8 stop_mode;
|
||||
};
|
||||
} __attribute__((__packed__));
|
||||
|
||||
void init_options (struct scanner *);
|
||||
void init_window (struct scanner *s, struct window *wnd, int wnd_id);
|
||||
|
|
|
@ -683,37 +683,37 @@ init_window (struct scanner *s, struct window *wnd, int wnd_id)
|
|||
{
|
||||
int paper = str_index (paper_list, s->val[PAPER_SIZE].s);
|
||||
memset (wnd, 0, sizeof (struct window));
|
||||
*(u16 *) wnd->window_descriptor_block_length = cpu2be16 (64);
|
||||
wnd->window_descriptor_block_length = cpu2be16 (64);
|
||||
|
||||
wnd->window_identifier = wnd_id;
|
||||
*(u16 *) wnd->x_resolution = cpu2be16 (s->val[RESOLUTION].w);
|
||||
*(u16 *) wnd->y_resolution = cpu2be16 (s->val[RESOLUTION].w);
|
||||
wnd->x_resolution = cpu2be16 (s->val[RESOLUTION].w);
|
||||
wnd->y_resolution = cpu2be16 (s->val[RESOLUTION].w);
|
||||
if (!paper)
|
||||
{
|
||||
*(u32 *) wnd->upper_left_x =
|
||||
wnd->upper_left_x =
|
||||
cpu2be32 (mm2scanner_units (s->val[TL_X].w));
|
||||
*(u32 *) wnd->upper_left_y =
|
||||
wnd->upper_left_y =
|
||||
cpu2be32 (mm2scanner_units (s->val[TL_Y].w));
|
||||
*(u32 *) wnd->width =
|
||||
wnd->width =
|
||||
cpu2be32 (mm2scanner_units (s->val[BR_X].w - s->val[TL_X].w));
|
||||
*(u32 *) wnd->length =
|
||||
wnd->length =
|
||||
cpu2be32 (mm2scanner_units (s->val[BR_Y].w - s->val[TL_Y].w));
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 w = cpu2be32 (mm2scanner_units (paper_sizes[paper].width));
|
||||
u32 h = cpu2be32 (mm2scanner_units (paper_sizes[paper].height));
|
||||
*(u32 *) wnd->upper_left_x = cpu2be32 (mm2scanner_units (0));
|
||||
*(u32 *) wnd->upper_left_y = cpu2be32 (mm2scanner_units (0));
|
||||
wnd->upper_left_x = cpu2be32 (mm2scanner_units (0));
|
||||
wnd->upper_left_y = cpu2be32 (mm2scanner_units (0));
|
||||
if (!s->val[LANDSCAPE].b)
|
||||
{
|
||||
*(u32 *) wnd->document_width = *(u32 *) wnd->width = w;
|
||||
*(u32 *) wnd->document_length = *(u32 *) wnd->length = h;
|
||||
wnd->document_width = wnd->width = w;
|
||||
wnd->document_length = wnd->length = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(u32 *) wnd->document_width = *(u32 *) wnd->width = h;
|
||||
*(u32 *) wnd->document_length = *(u32 *) wnd->length = w;
|
||||
wnd->document_width = wnd->width = h;
|
||||
wnd->document_length = wnd->length = w;
|
||||
}
|
||||
}
|
||||
wnd->brightness = s->val[BRIGHTNESS].w;
|
||||
|
@ -721,8 +721,8 @@ init_window (struct scanner *s, struct window *wnd, int wnd_id)
|
|||
wnd->contrast = s->val[CONTRAST].w;
|
||||
wnd->image_composition = mode_val[str_index (mode_list, s->val[MODE].s)];
|
||||
wnd->bit_per_pixel = bps_val[str_index (mode_list, s->val[MODE].s)];
|
||||
*(u16 *) wnd->halftone_pattern = 0; /*Does not supported */
|
||||
*(u16 *) wnd->bit_ordering = cpu2be16 (BIT_ORDERING);
|
||||
wnd->halftone_pattern = 0; /*Does not supported */
|
||||
wnd->bit_ordering = cpu2be16 (BIT_ORDERING);
|
||||
wnd->compression_type = 0; /*Does not supported */
|
||||
wnd->compression_argument = 0; /*Does not supported */
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue