test program to check usb hid devices
hi all: Is there any test program we can use to capture input data send from usb keyboard/mouse? I don't need to parsing the binary sent by keyboard/mouse. Just raw data is fine. I checked the Kernel sample, hid-example.c, but it seems only get report and print it out. appreciate your help in advance, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: test program to check usb hid devices
hi David: 2014-08-15 20:54 GMT+08:00 David Laight david.lai...@aculab.com: From: loody Is there any test program we can use to capture input data send from usb keyboard/mouse? google usbmon Sorry for making you confused. What I need is not monitor usb bus data. What I need is some user mode program, and when I execute it, it will driver usb HID keyboard/mouse to work. And I can print out the hex value those device send once user press any key on keyboard or moving mouse around. It should be like I think hid_device=hid_open(xxx); while(1){ data = get input data(hid_device); printf(0x%x\n,data); } Appreciate your kind help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi all: I try 2 methods today but there is no read command firing from usb host to device (I double check the existence of command by CATC protocol analyzer) appreciate all your kind suggestion. 1. use busybox like below command dd if=/dev/sda1 of=/dev/null bs=512 count=1 conv=sync my dd in busybox doesn't have iflags option # ./busybox.new dd help BusyBox v1.19.2 (2014-07-09 13:43:36 CST) multi-call binary. Usage: dd [if=FILE] [of=FILE] [ibs=N] [obs=N] [bs=N] [count=N] [skip=N] [seek=N] [conv=notrunc|noerror|sync|fsync] Copy a file with converting and formatting if=FILE Read from FILE instead of stdin of=FILE Write to FILE instead of stdout bs=NRead and write N bytes at a time ibs=N Read N bytes at a time obs=N Write N bytes at a time count=N Copy only N input blocks skip=N Skip N input blocks seek=N Skip N output blocks conv=notruncDon't truncate output file conv=noerrorContinue after read errors conv=sync Pad blocks with zeros conv=fsync Physically write data out before finishing 2. write c source file and open with O_DIRECT flag. #include stdio.h #include stdlib.h #include sys/types.h #include sys/stat.h #include fcntl.h char message[] = /mnt/usb/4854344154343452/test.txt; int main() { int fd; char buffer[5]; int count = 0; char *buf=1234567890; if((fd=open(message,O_CREAT|O_TRUNC|O_RDWR|O_DIRECT, 0777))0) { perror(open); return -1; } printf(fd=%d\n, fd); write(fd, buf, strlen(buf)); while(1){ lseek(fd,0,SEEK_SET); sleep(3); count = read(fd, buffer, 3); printf(count=%d,%x,%x,%x\n, count,buffer[0],buffer[1],buffer[2]); } } 2014-07-09 16:37 GMT+08:00 David Laight david.lai...@aculab.com: From: loody ... but what it really do is read sector, not media_change or test_unit_ready. Maybe one of the programs that reads the mbr partition table can be persuaded to do a direct read? David -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Bryn: 2014-07-08 0:25 GMT+08:00 Bryn M. Reeves b...@redhat.com: On Tue, Jul 08, 2014 at 12:15:54AM +0800, loody wrote: so sg_read will not hammer on the page cache like dd without iflags=direct thanks for your kind help, The sg_read program (and other programs in sg3_utils) sends a command directly to the device using an SG_IO ioctl. This bypasses all the caching layers in the kernel and always results in IO to the device (if it succeeds). I download sg utility but I found if I need to use sg_read only, I need to install sg_lig on my target system. is there any simple source I can reference for just doing the scsi read through IOCTL as you explained to us before? appreciate your kind help, -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Alan: 2014-07-08 1:02 GMT+08:00 Alan Stern st...@rowland.harvard.edu: On Tue, 8 Jul 2014, loody wrote: An alternative is to write a positive value, such as 24, to /sys/block/sdX/events_poll_msecs where X is replaced with the proper drive letter. (24 ms = 240 s = 4 m.) I'm not sure this will work, but it's worth a try. I cannot find events_poll_msecs you mentioned in my system. Is this capability related to kernel version? ( my kernel version is 2.6.38.8 ) Well, the in-kernel disk events mechanism was added in 2.6.38, but it may not have been implemented for your type of drive. You are correct. i can see events_poll_msecs when I change my kernel to 3.8.0 But the device still disconnect. I have some question. 1. when I cat /sys/block/sdX/events, I get the answer as media_change. is there any events type we can choose, such as read capability or inquiry. Probably you don't actually need to do a read. Simply opening the device file ought to be sufficient. 2. the open device you mean is like open(/dev/sda1)? thanks for all your kind help, -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Alan: 2014-07-09 0:00 GMT+08:00 Alan Stern st...@rowland.harvard.edu: On Tue, 8 Jul 2014, loody wrote: You are correct. i can see events_poll_msecs when I change my kernel to 3.8.0 But the device still disconnect. I have some question. 1. when I cat /sys/block/sdX/events, I get the answer as media_change. is there any events type we can choose, such as read capability or inquiry. The only other event type is eject_request. But that applies to CD drives, not disk drives. Probably you don't actually need to do a read. Simply opening the device file ought to be sufficient. 2. the open device you mean is like open(/dev/sda1)? Yes. That will send a SCSI TEST UNIT READY command, the same as disk events polling. You can use usbmon to verify this. However, maybe TEST UNIT READY won't work. Your drive might need to see a READ or WRITE command. If that's the case then neither events_poll_msecs nor a simple open() will help. Have you tried using hdparm with the -B or -S flag? there is one thing pop in my mind. if events_poll_msecs is used for media_change, shouldn't we wrap is READ10? the difference seems 1. change SCSI command 2. allocate 512 Byte for 1 sector dummy read the periodically trigging flow should be the same. if you think above is possible, where we should start from? appreciate your help -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Alan: 2014-07-09 3:26 GMT+08:00 Alan Stern st...@rowland.harvard.edu: On Wed, 9 Jul 2014, loody wrote: there is one thing pop in my mind. if events_poll_msecs is used for media_change, shouldn't we wrap is READ10? No. Why should media change polling use READ(10)? TEST UNIT READY does a good job of detecting media changes. the difference seems 1. change SCSI command 2. allocate 512 Byte for 1 sector dummy read the periodically trigging flow should be the same. if you think above is possible, where we should start from? Why do you want to make this change? on that usb hard disk, no matter media_change or TEST_UNIT_READY, keep polling the device every 3mins. the disconnection still happen. So I am wondering, I can use the existence wheel, such as echo 4 /sys/block/sda/events_poll_ msecs. but what it really do is read sector, not media_change or test_unit_ready. thanks for your kind help -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Bryn: 2014-07-07 17:20 GMT+08:00 Bryn M. Reeves b...@redhat.com: On Sun, Jul 06, 2014 at 01:18:03AM +0800, loody wrote: hi all: we met a USB Hard Disk that will go to suspend if host stop sending scsi command over 5mins. To save the IO, kernel will keep the file in page cache as much as he can and under this circumstances, the scsi command may disappear for a while longer enough to cause the device suspend. is there any kernel config or module parameter can do the dummy read or scsi command periodically? No but you could set up a simple cron job to call an sg3_utils command. E.g. issue an sg_read for one sector to the device every 4m: */4 * * * * sg_read count=1 if=/dev/disk Since my target platform arm embedded system, does that mean I should include sg_read in my Busybox or cross-compile sg_read from sg3_utils? appreciate your kind help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi David: 2014-07-07 23:06 GMT+08:00 David Laight david.lai...@aculab.com: From: Lars Melin ... sgread is not included in BusyBox but you should have touch. Create a dummy file on the disk and let cron touch it every 4 minutes. You don't need 'touch' a shell redirect eg : file will do open(..., O_CREAT|O_TRUNC). However that still might not force an actual disc access. In any case you really only want to do a read, doing a write will kill the NAND memory. actually I have searched the scsi/usb layer for possible dummy read, even read sector 0 is fine, but in vain. I found the read a. determined by VFS - block layer, b. Block layer put it in queue c. call scsi pre-queue function to usb layer. That mean if I try to read sector from usb devices, I have to create a queue and follow above b) and c) rule. is there any already kernel API I can use? sincerely appreciate all yours help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Alan: E.g. issue an sg_read for one sector to the device every 4m: */4 * * * * sg_read count=1 if=/dev/disk Since my target platform arm embedded system, does that mean I should include sg_read in my Busybox or cross-compile sg_read from sg3_utils? An alternative is to write a positive value, such as 24, to /sys/block/sdX/events_poll_msecs where X is replaced with the proper drive letter. (24 ms = 240 s = 4 m.) I'm not sure this will work, but it's worth a try. I cannot find events_poll_msecs you mentioned in my system. Is this capability related to kernel version? ( my kernel version is 2.6.38.8 ) Sincerely appreciate all yours kind help, PS: below is result of /sys/block/sdb/ /sys/block/sdb# ls -lht total 0 -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 alignment_offset lrwxrwxrwx 1 root root0 2014-07-08 00:08 bdi - ../../../../../../../../../../virtual/bdi/8:16 -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 capability -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 dev lrwxrwxrwx 1 root root0 2014-07-08 00:08 device - ../../../3:0:0:0 -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 discard_alignment -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 ext_range -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 inflight drwxr-xr-x 2 root root0 2014-07-08 00:08 power -r--r--r-- 1 root root 4.0K 2014-07-08 00:08 stat drwxr-xr-x 2 root root0 2014-07-08 00:08 trace drwxr-xr-x 2 root root0 2014-07-08 00:05 holders drwxr-xr-x 3 root root0 2014-07-08 00:05 queue -r--r--r-- 1 root root 4.0K 2014-07-08 00:05 range -r--r--r-- 1 root root 4.0K 2014-07-08 00:05 ro drwxr-xr-x 5 root root0 2014-07-08 00:05 sdb1 -r--r--r-- 1 root root 4.0K 2014-07-08 00:05 size drwxr-xr-x 2 root root0 2014-07-08 00:05 slaves -r--r--r-- 1 root root 4.0K 2014-07-08 00:05 removable lrwxrwxrwx 1 root root0 2014-07-08 00:05 subsystem - ../../../../../../../../../../../class/block -rw-r--r-- 1 root root 4.0K 2014-07-08 00:05 uevent /sys/block/sdb# -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dummy scsi read or scsi command periodically for external USB Hard Disk
hi Bryn: 2014-07-07 23:52 GMT+08:00 Bryn M. Reeves b...@redhat.com: On Mon, Jul 07, 2014 at 11:39:05PM +0800, loody wrote: hi David: 2014-07-07 23:06 GMT+08:00 David Laight david.lai...@aculab.com: From: Lars Melin ... sgread is not included in BusyBox but you should have touch. Create a dummy file on the disk and let cron touch it every 4 minutes. You don't need 'touch' a shell redirect eg : file will do open(..., O_CREAT|O_TRUNC). However that still might not force an actual disc access. In any case you really only want to do a read, doing a write will kill the NAND memory. actually I have searched the scsi/usb layer for possible dummy read, even read sector 0 is fine, but in vain. I found the read a. determined by VFS - block layer, b. Block layer put it in queue c. call scsi pre-queue function to usb layer. That mean if I try to read sector from usb devices, I have to create a queue and follow above b) and c) rule. is there any already kernel API I can use? sincerely appreciate all yours help, If you don't want to put sg_read into your image you could just use a dd; busybox includes an implementation that should be good enough. Just make sure you use the right flags to use O_DIRECT access or you'll just end up hammering on the page cache. Iirc that's iflags=direct (check the busybox docs to make sure it's the same). so sg_read will not hammer on the page cache like dd without iflags=direct thanks for your kind help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
dummy scsi read or scsi command periodically for external USB Hard Disk
hi all: we met a USB Hard Disk that will go to suspend if host stop sending scsi command over 5mins. To save the IO, kernel will keep the file in page cache as much as he can and under this circumstances, the scsi command may disappear for a while longer enough to cause the device suspend. is there any kernel config or module parameter can do the dummy read or scsi command periodically? appreciate your help in advance, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: how to firing device event when SD card inserting usb card reader
hi Alan: 2014-06-26 23:57 GMT+08:00 Alan Stern st...@rowland.harvard.edu: On Thu, 26 Jun 2014, loody wrote: hi all: I try below flow: 1. plug in usb card reader 2. wait 2 seconds 3. plug in SD card on ubuntu PC system, the udev can get SD plug in event but on my embedded system, there is no udev plug event when SD plug in. Is this issue related to media change command? if so, should I enable kernel config or do anything in user mode program? thanks for your help in advance, What does usbmon show? after we enable CONFIG_SCSI_MULTI_LUN, we can udevent when SD plug in card reader. appreciate your kind help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Some question about usb scsi storage driver
hi all: when I trace kernel driver source about usb scsi storage driver, I have below 2 questions: 1. in sd.c - static int sd_probe(struct device *dev) we use below macro to get scsi_device. struct scsi_device *sdp = to_scsi_device(dev); take usb for example, is usb storage driver allocate memory for scsi_device then calling sd_probe? I am looking for usb_stor_probe1 and usb_stor_probe2 but not find where it is. 2. at the end of sd.c - sd_probe, why we call async_schedule_domain like below async_schedule_domain(sd_probe_async, sdkp, scsi_sd_probe_domain); to finish scsi device initialization? Couldn't we put what sd_probe_async directly in sd_probe? is there any benefit to do so? -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
how to firing device event when SD card inserting usb card reader
hi all: I try below flow: 1. plug in usb card reader 2. wait 2 seconds 3. plug in SD card on ubuntu PC system, the udev can get SD plug in event but on my embedded system, there is no udev plug event when SD plug in. Is this issue related to media change command? if so, should I enable kernel config or do anything in user mode program? thanks for your help in advance, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Weird I/O errors with USB Hard disk
hi all: I have a USB hard disk and when I play specific file. it will show below message ( I purpose enable usb/storage/transport.c debug message about urb debug) what makes me confused are 1. Does Unhandled sense code mean the SCSI Request Sense command? 2. if #1 is correct, there should be any error handling for not keep sending following commands. Why usb driver keep clear this halt enpoint? isn't there any timeout mechanism no matter in scsi layer or usb layer? appreciate your help [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]sd 0:0:0:0: [sda] Unhandled sense code [22:06:48]sd 0:0:0:0: [sda] Result: hostbyte=0x10 driverbyte=0x08 [22:06:48]sd 0:0:0:0: [sda] Sense Key : 0x3 [current] [22:06:48]sd 0:0:0:0: [sda] ASC=0x11 ASCQ=0x0 [22:06:48]sd 0:0:0:0: [sda] CDB: cdb[0]=0x28: 28 00 00 24 42 22 00 00 f0 00 [22:06:48]end_request: critical target error, dev sda, sector 2376226 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]-- short read transfer [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 [22:06:49]-- short read transfer [22:06:49]clearing endpoint halt for pipe 0xc0008280 .. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Weird I/O errors with USB Hard disk
hi James: 2014-05-10 23:10 GMT+08:00 James Bottomley james.bottom...@hansenpartnership.com: On Sat, 2014-05-10 at 22:38 +0800, loody wrote: hi all: I have a USB hard disk and when I play specific file. it will show below message ( I purpose enable usb/storage/transport.c debug message about urb debug) what makes me confused are 1. Does Unhandled sense code mean the SCSI Request Sense command? Error handling couldn't correct the error so it was passed up. 2. if #1 is correct, there should be any error handling for not keep sending following commands. Why usb driver keep clear this halt enpoint? isn't there any timeout mechanism no matter in scsi layer or usb layer? appreciate your help [22:06:48]clearing endpoint halt for pipe 0xc0008280 [22:06:48]sd 0:0:0:0: [sda] Unhandled sense code [22:06:48]sd 0:0:0:0: [sda] Result: hostbyte=0x10 driverbyte=0x08 [22:06:48]sd 0:0:0:0: [sda] Sense Key : 0x3 [current] [22:06:48]sd 0:0:0:0: [sda] ASC=0x11 ASCQ=0x0 [22:06:48]sd 0:0:0:0: [sda] CDB: cdb[0]=0x28: 28 00 00 24 42 22 00 00 f0 00 [22:06:48]end_request: critical target error, dev sda, sector 2376226 If you compiled your kernel with SCSI messages it would tell you that this is a medium error, unrecovered read error in sector 2376226 The device is failing and the sector cannot be recovered. in my opinion, the OS will not hang up when this problem happen, right? But my platform is always trying to clear halt endpoint, and it seems Block or File system layer still try to access this sector. is that related to file node open method or file read method? such that read bad sector will hang up the OS. -- Appreciate your help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: is it possible to temporarily not let user mode get hid input event
hi David: 2014-02-23 23:16 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Sun, Feb 23, 2014 at 7:52 AM, loody milo...@gmail.com wrote: hi David: Thanks for your suggestion. 2014-02-23 0:56 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Sat, Feb 22, 2014 at 5:35 PM, loody milo...@gmail.com wrote: hi all: is there any kernel hid module parameter or test program can temporarily not letting user mode program not receiving hid event? 1. My hid kos are still inserted in. 2. the kernel usb driver is working well; that mean kernel usb driver still handle interrupt transaction. I just not want user mode program see the hid event for a while, For each connected HID device, there is a driver bound to it that reads the events and forwards them to HID core. What you can do, is to unbind a driver on a given device: echo your-device-name /sys/bus/hid/drivers/driver-name/unbind The device-name is the directory name in: /sys/bus/hid/devices/ The driver name is usually hid-generic but can be figured out for each device by looking at the driver symlink in it's directry. However, this is *really* just meant for debugging. This is not recommended for anything serious. There is no support for that and if you don't know what all this does, you shouldn't use it. There is no proper way to disable a single device in the kernel. User-space is supposed to control device-access so we probably won't add such features to the kernel. If you describe your use-case in more details, we can try to give hints how to get that working. Sorry for not describing our situation clearer previously, The problem we met like below a. once plug in usb hid mouse and fast moving mouse b. the screen will get blur. We want to know whether the screen blur is caused by 1. the interrupt frequency of usb mouse is too high for our embedded system that make video decode slow 2. something wrong between hw cursor and video overlay. if we can deceive user mode program there is no mouse event, but kernel usb level still get hid interrupt transaction. We may clarify whether above 1) conclusion is correct. Appreciate your kind help :-) You can unload the HID driver as described above, but that's unlikely to fix any interrupt issues. How about you compile your kernel without usbhid support? (CONFIG_USB_HID) BTW, is there any fake virtual mouse to use? That mean user doesn't plug in any usb hid mouse, but user mode program can receive hid mouse event? -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: is it possible to temporarily not let user mode get hid input event
hi David: 2014-02-24 19:35 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Mon, Feb 24, 2014 at 12:20 PM, loody milo...@gmail.com wrote: hi David: 2014-02-23 23:16 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Sun, Feb 23, 2014 at 7:52 AM, loody milo...@gmail.com wrote: hi David: Thanks for your suggestion. 2014-02-23 0:56 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Sat, Feb 22, 2014 at 5:35 PM, loody milo...@gmail.com wrote: hi all: is there any kernel hid module parameter or test program can temporarily not letting user mode program not receiving hid event? 1. My hid kos are still inserted in. 2. the kernel usb driver is working well; that mean kernel usb driver still handle interrupt transaction. I just not want user mode program see the hid event for a while, For each connected HID device, there is a driver bound to it that reads the events and forwards them to HID core. What you can do, is to unbind a driver on a given device: echo your-device-name /sys/bus/hid/drivers/driver-name/unbind The device-name is the directory name in: /sys/bus/hid/devices/ The driver name is usually hid-generic but can be figured out for each device by looking at the driver symlink in it's directry. However, this is *really* just meant for debugging. This is not recommended for anything serious. There is no support for that and if you don't know what all this does, you shouldn't use it. There is no proper way to disable a single device in the kernel. User-space is supposed to control device-access so we probably won't add such features to the kernel. If you describe your use-case in more details, we can try to give hints how to get that working. Sorry for not describing our situation clearer previously, The problem we met like below a. once plug in usb hid mouse and fast moving mouse b. the screen will get blur. We want to know whether the screen blur is caused by 1. the interrupt frequency of usb mouse is too high for our embedded system that make video decode slow 2. something wrong between hw cursor and video overlay. if we can deceive user mode program there is no mouse event, but kernel usb level still get hid interrupt transaction. We may clarify whether above 1) conclusion is correct. Appreciate your kind help :-) You can unload the HID driver as described above, but that's unlikely to fix any interrupt issues. How about you compile your kernel without usbhid support? (CONFIG_USB_HID) BTW, is there any fake virtual mouse to use? That mean user doesn't plug in any usb hid mouse, but user mode program can receive hid mouse event? Yes. For instance, you can run ./samples/uhid/uhid-example.c via ssh to emulate a mouse. ssh keyboard input can then be used to generate mouse-movement events. There is one embarrassing question :-) Would you please let me know how to cross-compile it ? I try below commands but failed #cd samples/uhid/ #make CROSS_COMPILE=arm-v7a8v4r2-linux-gnueabi- make: *** No targets. Stop. Thanks for your kind help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
is it possible to temporarily not let user mode get hid input event
hi all: is there any kernel hid module parameter or test program can temporarily not letting user mode program not receiving hid event? 1. My hid kos are still inserted in. 2. the kernel usb driver is working well; that mean kernel usb driver still handle interrupt transaction. I just not want user mode program see the hid event for a while, Appreciate your kind help in advance, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: is it possible to temporarily not let user mode get hid input event
hi David: Thanks for your suggestion. 2014-02-23 0:56 GMT+08:00 David Herrmann dh.herrm...@gmail.com: Hi On Sat, Feb 22, 2014 at 5:35 PM, loody milo...@gmail.com wrote: hi all: is there any kernel hid module parameter or test program can temporarily not letting user mode program not receiving hid event? 1. My hid kos are still inserted in. 2. the kernel usb driver is working well; that mean kernel usb driver still handle interrupt transaction. I just not want user mode program see the hid event for a while, For each connected HID device, there is a driver bound to it that reads the events and forwards them to HID core. What you can do, is to unbind a driver on a given device: echo your-device-name /sys/bus/hid/drivers/driver-name/unbind The device-name is the directory name in: /sys/bus/hid/devices/ The driver name is usually hid-generic but can be figured out for each device by looking at the driver symlink in it's directry. However, this is *really* just meant for debugging. This is not recommended for anything serious. There is no support for that and if you don't know what all this does, you shouldn't use it. There is no proper way to disable a single device in the kernel. User-space is supposed to control device-access so we probably won't add such features to the kernel. If you describe your use-case in more details, we can try to give hints how to get that working. Sorry for not describing our situation clearer previously, The problem we met like below a. once plug in usb hid mouse and fast moving mouse b. the screen will get blur. We want to know whether the screen blur is caused by 1. the interrupt frequency of usb mouse is too high for our embedded system that make video decode slow 2. something wrong between hw cursor and video overlay. if we can deceive user mode program there is no mouse event, but kernel usb level still get hid interrupt transaction. We may clarify whether above 1) conclusion is correct. Appreciate your kind help :-) -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Some questions about Xhci bulk protocol streaming
hi all and Sarah: I have some questions about xhci bulk transfer streaming protocol in linux. i bought a device which declare it support USB Attached SCSI Protocol. (please reference the attach descriptor) and from below link, the kernel will support this transfer once I insert uas.ko. https://lkml.org/lkml/2011/4/25/26 But I cannot record any stream protocol from catc analyzer. Should I open any other kernel config instead of only inserting uas.ko? Thanks for your great help, uasp.devices.desc Description: Binary data
Re: some question about xhci ep0 setting
hi sarah On Sat, Oct 06, 2012 at 12:53:43PM +0800, loody wrote: hi sarah: 2012/10/6 Sarah Sharp sarah.a.sh...@linux.intel.com: I see. Is there a particular reason why the current Linux xHCI driver doesn't meet your needs? Like maybe your host isn't PCI based? I'm confused as to why you would need to understand the low-level details of ring management if you're doing a simple port. Yes, you are correct. My platform is not PCI based system and OS is not BSD/Linux as well. so I cannot do a simple port. I hope you know what you're doing licensing-wise then. The xHCI driver is GPL v2, and that means any changes you make to it are going to have to be released as well. And if you're attempting to read the xHCI driver code to understand how you should write your own driver, then you may run into license troubles there. IANAL, so you should ask a good lawyer who knows open source licensing. Yes, I know we should following the spirit of GPL v2. thanks for your help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some question about xhci ep0 setting
hi Sarah: 2012/10/5 Sarah Sharp sarah.a.sh...@linux.intel.com: On Thu, Oct 04, 2012 at 01:47:44PM +0800, loody wrote: Hi all: from below out put slot context it shows ep0 consumer cycle bit is 1 but why when we enqueue control transfer we purposely leave setup status cycle bit as 0. (below I purpose dump control trb content and 0xcf01c80c should be 0x0841 instead of 0x0840, right?) [192016.504076] address trb: cf01c800: 01000680 0008 0008 0840 [192016.505593] address trb: cf01c810: 30e1fdc0 0008 00010c05 [192016.507129] address trb: cf01c820: 1021 We leave the setup status cycle bit as zero until we've written the status phase to the ring. This is to prevent the host from executing the control transfer until it's fully written to the ring. We do the same thing for all transfer descriptors (TD) that have more than one transfer request buffer (TRB). BTW, if you're asking questions about the xHCI driver, you really should put me on Cc. Otherwise your mail might get lost in all the other linux-usb mail I get. Why are you asking all these questions about the driver? What are you trying to accomplish? Nice to meet U ~^^~ I am trying to port xhci driver on my platform based on linux driver. That is why I ask these questions. -- Thanks for your help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some question about xhci spec
hi alan: 2012/10/4 Alan Stern st...@rowland.harvard.edu: On Thu, 4 Oct 2012, loody wrote: hi all: in xhci spec rev1.0 05/21/10 section 6.2.3.4, there is a line said For SuperSpeed endpoints this field shall be set to the value defined in the bMaxBurst field of the SuperSpeed Endpoint Companion Descriptor. Refer to section 8.6.8 of the USB3 Specification. but I cannot find section 8.6.8 in usb3 spec I download from usb.org. Does anyone can tell me where I can find this section? Section 9.6.7. is that a typo in xhci spec? I am just afraid I am not downloading the latest xhci spec. Thanks for your help ^^ -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some questions about xhci bandwidth
hi Andiry: 2012/9/3 Andiry Xu and...@gmail.com: On Wed, Aug 29, 2012 at 6:53 AM, loody milo...@gmail.com wrote: hi all: I saw there are 2 trbs about bandwidth as below: #define TRB_GET_BW 21 #define TRB_BANDWIDTH_EVENT 35 Would any one tell me where I can see driver use these 2 trbs for bandwidth checking, since I cannot grep the implementation in the driver. It's defined by xHCI spec but currently not used by driver. They're less important. from the protocol type, it seems to implement split transaction. if it is, when I plug a HS hub with FS device on its downstream ports, the driver need these packets to know whether it is ok to schedule traffic for this device. If I guest wrong, please let me know. Thanks for your help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: xhci inc_deq question
hi Sebastian 2012/8/18 Sebastian Andrzej Siewior sebast...@breakpoint.cc: On Wed, Aug 08, 2012 at 08:55:37PM +0800, loody wrote: when I study inc_deq in xhci-ring.c, why we need to announce and assigned value to addr it seems useless. Unless Sarah plans to use addr for debug output you can remove this addr and the one in the function below. Andiry Xu has told me this usage before. Thanks for your help, -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
xhci inc_deq question
hi all: when I study inc_deq in xhci-ring.c, why we need to announce and assigned value to addr it seems useless. static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) { unsigned long long addr; .. .. addr = (unsigned long long) xhci_trb_virt_to_dma(ring-deq_seg, ring-dequeue); } -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some questions about usb_serial_probe
hi all: 2012/7/18 loody milo...@gmail.com: hi: 2012/7/18 Greg KH gre...@linuxfoundation.org: On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote: Dear all: in usb_serial_probe, we create tty_port based on max_endpoints. Or based on the number that the driver said to create. My questions are: 1. some callback functions, such serial_hangup, serial_carrier_raised, etc. will called by tty layer with different tty_ports. how tty layer know these tty_ports? They were registered with the tty layer. I only found tty_port_init to initial these tty_ports, but where we register these tty_ports to tty layer? When we register the tty device. Would you mind to tell me which function it is? after tracing source code, usb_serial_device_probe seems where we register tty device. But we only let tty know, tty_driver, index and struct device. it seems we don't let tty know how many tty_ports we created. Thanks for your help in advance, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some questions about usb_serial_probe
Hi: 2012/7/18 Alan Stern st...@rowland.harvard.edu: On Wed, 18 Jul 2012, loody wrote: hi all: 2012/7/18 loody milo...@gmail.com: hi: 2012/7/18 Greg KH gre...@linuxfoundation.org: On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote: Dear all: in usb_serial_probe, we create tty_port based on max_endpoints. Or based on the number that the driver said to create. My questions are: 1. some callback functions, such serial_hangup, serial_carrier_raised, etc. will called by tty layer with different tty_ports. how tty layer know these tty_ports? They were registered with the tty layer. I only found tty_port_init to initial these tty_ports, but where we register these tty_ports to tty layer? When we register the tty device. Would you mind to tell me which function it is? after tracing source code, usb_serial_device_probe seems where we register tty device. But we only let tty know, tty_driver, index and struct device. it seems we don't let tty know how many tty_ports we created. Thanks for your help in advance, You didn't look at usb_serial_probe. At the end of that function there I found what you mentioned. for (i = 0; i num_ports; ++i) { retval = device_add(port-dev); ... is a loop which runs over all the ports and registers them one at a time with the device layer. When it is registered, the port is passed to usb_serial_device_probe, which then registers the port with the tty layer. The port we pass to usb_serial_device_probe are usb_serial_port instead of tty_port, we get it through to_usb_serial_port(dev); in usb_serial_device_probe, it do following things. 1. try to call port_probe, which seems do some control for usb_port instead of tty port. 2. calling device_create_file(dev, dev_attr_port_number); dev in above function is embedded in usb_port not in tty_port. 3. tty_register_device(usb_serial_tty_driver, minor, dev); this is most likely where we register tty port. but all three parameters have no relations to tty port. if above flow is correct, how tty layer know how many tty_ports this usb device have? appreciate your help, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
some questions about usb_serial_probe
Dear all: in usb_serial_probe, we create tty_port based on max_endpoints. My questions are: 1. some callback functions, such serial_hangup, serial_carrier_raised, etc. will called by tty layer with different tty_ports. how tty layer know these tty_ports? I only found tty_port_init to initial these tty_ports, but where we register these tty_ports to tty layer? -- Regards, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: some questions about usb_serial_probe
hi: 2012/7/18 Greg KH gre...@linuxfoundation.org: On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote: Dear all: in usb_serial_probe, we create tty_port based on max_endpoints. Or based on the number that the driver said to create. My questions are: 1. some callback functions, such serial_hangup, serial_carrier_raised, etc. will called by tty layer with different tty_ports. how tty layer know these tty_ports? They were registered with the tty layer. I only found tty_port_init to initial these tty_ports, but where we register these tty_ports to tty layer? When we register the tty device. Would you mind to tell me which function it is? greg k-h -- Thanks a lot, -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html