Discussion:
[libhid-discuss] Inconsistency while reading data from the usb device
shiva vadla
2010-12-09 00:12:22 UTC
Permalink
Hello All,
I am trying to read the card data from a credit card reader (usb device)
using interrupt endpoint. I can open and claim the hid interface and read
the data from the card reader. But if I close and delete the hid interface
after i am done reading and try to read the data again for the next card
swipe, i miss the first packet (8 bytes) of the data on every alternate
read. I am not sure why this is happening. If i do not close the hid
interface and keep my program running, i do not see any issues. Any help is
appreciated.
Thanks!
--
Shiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101208/898c929c/attachment.htm>
Xiaofan Chen
2010-12-09 05:23:02 UTC
Permalink
Post by shiva vadla
Hello All,
I am trying to read the card data from a credit card reader (usb device)
using interrupt endpoint. I can open and claim the hid interface and read
the data from the card reader. But if I close and delete the hid interface
after i am done reading and try to read the data again for the next card
swipe, i miss the first packet (8 bytes) of the data on every alternate
read. I am not sure why this is happening. If i do not close the hid
interface and keep my program running, i do not see any issues. Any help is
appreciated.
Just a guess, what if you reset the hid interface before closing
the interface?
--
Xiaofan
shiva vadla
2010-12-09 17:48:32 UTC
Permalink
Thanks for the response. I have just tried that, but I still see the same
issue. Any suggestions?
Post by shiva vadla
Post by shiva vadla
Hello All,
I am trying to read the card data from a credit card reader (usb device)
using interrupt endpoint. I can open and claim the hid interface and read
the data from the card reader. But if I close and delete the hid
interface
Post by shiva vadla
after i am done reading and try to read the data again for the next card
swipe, i miss the first packet (8 bytes) of the data on every alternate
read. I am not sure why this is happening. If i do not close the hid
interface and keep my program running, i do not see any issues. Any help
is
Post by shiva vadla
appreciated.
Just a guess, what if you reset the hid interface before closing
the interface?
--
Xiaofan
--
Shiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101209/8cb00a17/attachment.htm>
Xiaofan Chen
2010-12-10 03:27:28 UTC
Permalink
Post by shiva vadla
Post by Xiaofan Chen
Just a guess, what if you reset the hid interface before closing
the interface?
Thanks for the response. I have just tried that, but I still see the same
issue. Any suggestions?
Sorry I have no idea. Maybe you want to ask in the Linux usb mailing
list cause I do not think this is a libhid/libusb issue, but rather a
usb device issue. They will probably ask you to provide the
usbmon log or things like that.


--
Xiaofan
Manuel F Martinez
2010-12-10 06:11:54 UTC
Permalink
Are you able to post your code? maybe it can help everyone to see what you
are trying to accomplish.

Thanks,
Post by Xiaofan Chen
Post by shiva vadla
Post by Xiaofan Chen
Just a guess, what if you reset the hid interface before closing
the interface?
Thanks for the response. I have just tried that, but I still see the same
issue. Any suggestions?
Sorry I have no idea. Maybe you want to ask in the Linux usb mailing
list cause I do not think this is a libhid/libusb issue, but rather a
usb device issue. They will probably ask you to provide the
usbmon log or things like that.
--
Xiaofan
_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
--
Manuel F Martinez
Linux Systems Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101209/83cfae71/attachment.htm>
shiva vadla
2010-12-10 16:24:08 UTC
Permalink
I think it's the kernel issue. I was trying it on CentOs 2.6.18 and it
wasn't working. But when I tried on OpenSuse 11.3, it works fine. Thanks all
for your help.
Post by Manuel F Martinez
Are you able to post your code? maybe it can help everyone to see what you
are trying to accomplish.
Thanks,
Post by Xiaofan Chen
Post by shiva vadla
Post by Xiaofan Chen
Just a guess, what if you reset the hid interface before closing
the interface?
Thanks for the response. I have just tried that, but I still see the
same
Post by shiva vadla
issue. Any suggestions?
Sorry I have no idea. Maybe you want to ask in the Linux usb mailing
list cause I do not think this is a libhid/libusb issue, but rather a
usb device issue. They will probably ask you to provide the
usbmon log or things like that.
--
Xiaofan
_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
--
Manuel F Martinez
Linux Systems Engineer
--
Shiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101210/0917a4ec/attachment.htm>
Manuel F Martinez
2010-12-11 07:52:50 UTC
Permalink
Good to hear that, anyways, feel free to post your code if you still want to
try CentOS, I'll be happy to help.
I successfully build apps for some USB devices on CentOS 5 with 2.6.18
kernel.

Thanks,
Post by shiva vadla
I think it's the kernel issue. I was trying it on CentOs 2.6.18 and it
wasn't working. But when I tried on OpenSuse 11.3, it works fine. Thanks all
for your help.
Post by Manuel F Martinez
Are you able to post your code? maybe it can help everyone to see what
you are trying to accomplish.
Thanks,
Post by Xiaofan Chen
Post by shiva vadla
Post by Xiaofan Chen
Just a guess, what if you reset the hid interface before closing
the interface?
Thanks for the response. I have just tried that, but I still see the
same
Post by shiva vadla
issue. Any suggestions?
Sorry I have no idea. Maybe you want to ask in the Linux usb mailing
list cause I do not think this is a libhid/libusb issue, but rather a
usb device issue. They will probably ask you to provide the
usbmon log or things like that.
--
Xiaofan
_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
--
Manuel F Martinez
Linux Systems Engineer
--
Shiva
--
Manuel F Martinez
Linux Systems Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101210/ab048be1/attachment.htm>
shiva vadla
2010-12-13 19:55:23 UTC
Permalink
Here is the code. I am using java to load the libhid library and talk to the
device.

LibHid libHid = LibHid.libHid;

libHid.hid_set_debug(HIDDebugLevel.ALL);
libHid.hid_init();
LibHid.HIDInterfaceMatcher hidMatcher = new
LibHid.HIDInterfaceMatcher((short) 0x0801, (short) 0x0011, null, null, 0);
libHid.hid_force_open(hidInterface, 0, hidMatcher, (short) 3);
libHid.hid_interrupt_read(hidInterface, 0x81, output, 887, 0);
libHid.hid_close(hidInterface);
libHid.hid_delete_HIDInterface(hidInterface);
libHid.hid_cleanup()

Thanks!
Post by Manuel F Martinez
Good to hear that, anyways, feel free to post your code if you still want
to try CentOS, I'll be happy to help.
I successfully build apps for some USB devices on CentOS 5 with 2.6.18
kernel.
Thanks,
Post by shiva vadla
I think it's the kernel issue. I was trying it on CentOs 2.6.18 and it
wasn't working. But when I tried on OpenSuse 11.3, it works fine. Thanks all
for your help.
Post by Manuel F Martinez
Are you able to post your code? maybe it can help everyone to see what
you are trying to accomplish.
Thanks,
Post by Xiaofan Chen
Post by shiva vadla
Post by Xiaofan Chen
Just a guess, what if you reset the hid interface before closing
the interface?
Thanks for the response. I have just tried that, but I still see the
same
Post by shiva vadla
issue. Any suggestions?
Sorry I have no idea. Maybe you want to ask in the Linux usb mailing
list cause I do not think this is a libhid/libusb issue, but rather a
usb device issue. They will probably ask you to provide the
usbmon log or things like that.
--
Xiaofan
_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/
--
Manuel F Martinez
Linux Systems Engineer
--
Shiva
--
Manuel F Martinez
Linux Systems Engineer
--
Shiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20101213/491584be/attachment.htm>
Loading...