Commit 1722f3b3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB: sms: properly initialize IR phys and IR name

sms were using a non-compliant nomenclature for the USB devices. Fix it.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4eebfb0a
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/input.h> #include <linux/input.h>
#include <media/ir-core.h>
#include "smscoreapi.h" #include "smscoreapi.h"
#include "smsir.h" #include "smsir.h"
...@@ -247,6 +248,7 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len) ...@@ -247,6 +248,7 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len)
int sms_ir_init(struct smscore_device_t *coredev) int sms_ir_init(struct smscore_device_t *coredev)
{ {
struct input_dev *input_dev; struct input_dev *input_dev;
int board_id = smscore_get_board_id(coredev);
sms_log("Allocating input device"); sms_log("Allocating input device");
input_dev = input_allocate_device(); input_dev = input_allocate_device();
...@@ -256,8 +258,7 @@ int sms_ir_init(struct smscore_device_t *coredev) ...@@ -256,8 +258,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
} }
coredev->ir.input_dev = input_dev; coredev->ir.input_dev = input_dev;
coredev->ir.ir_kb_type = coredev->ir.ir_kb_type = sms_get_board(board_id)->ir_kb_type;
sms_get_board(smscore_get_board_id(coredev))->ir_kb_type;
coredev->ir.keyboard_layout_map = coredev->ir.keyboard_layout_map =
keyboard_layout_maps[coredev->ir.ir_kb_type]. keyboard_layout_maps[coredev->ir.ir_kb_type].
keyboard_layout_map; keyboard_layout_map;
...@@ -269,11 +270,15 @@ int sms_ir_init(struct smscore_device_t *coredev) ...@@ -269,11 +270,15 @@ int sms_ir_init(struct smscore_device_t *coredev)
coredev->ir.controller, coredev->ir.timeout); coredev->ir.controller, coredev->ir.timeout);
snprintf(coredev->ir.name, snprintf(coredev->ir.name,
IR_DEV_NAME_MAX_LEN, sizeof(coredev->ir.name),
"SMS IR w/kbd type %d", "SMS IR (%s)",
coredev->ir.ir_kb_type); sms_get_board(board_id)->name);
strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys));
strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys));
input_dev->name = coredev->ir.name; input_dev->name = coredev->ir.name;
input_dev->phys = coredev->ir.name; input_dev->phys = coredev->ir.phys;
input_dev->dev.parent = coredev->device; input_dev->dev.parent = coredev->device;
/* Key press events only */ /* Key press events only */
......
...@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <linux/input.h> #include <linux/input.h>
#define IR_DEV_NAME_MAX_LEN 23 /* "SMS IR kbd type nn\0" */ #define IR_DEV_NAME_MAX_LEN 40
#define IR_KEYBOARD_LAYOUT_SIZE 64 #define IR_KEYBOARD_LAYOUT_SIZE 64
#define IR_DEFAULT_TIMEOUT 100 #define IR_DEFAULT_TIMEOUT 100
...@@ -78,7 +78,8 @@ struct smscore_device_t; ...@@ -78,7 +78,8 @@ struct smscore_device_t;
struct ir_t { struct ir_t {
struct input_dev *input_dev; struct input_dev *input_dev;
enum ir_kb_type ir_kb_type; enum ir_kb_type ir_kb_type;
char name[IR_DEV_NAME_MAX_LEN+1]; char name[IR_DEV_NAME_MAX_LEN + 1];
char phys[32];
u16 *keyboard_layout_map; u16 *keyboard_layout_map;
u32 timeout; u32 timeout;
u32 controller; u32 controller;
......
...@@ -352,8 +352,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) ...@@ -352,8 +352,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
params.num_buffers = MAX_BUFFERS; params.num_buffers = MAX_BUFFERS;
params.sendrequest_handler = smsusb_sendrequest; params.sendrequest_handler = smsusb_sendrequest;
params.context = dev; params.context = dev;
snprintf(params.devpath, sizeof(params.devpath), usb_make_path(dev->udev, params.devpath, sizeof(params.devpath));
"usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath);
/* register in smscore */ /* register in smscore */
rc = smscore_register_device(&params, &dev->coredev); rc = smscore_register_device(&params, &dev->coredev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment